Unable to authenticate through API - Slim Exception

Before posting something, READ the changelog, WATCH the videos, howto and provide following:
Your install is: Bare metal, ESXi, what CPU model, RAM, HD, what EVE version you have, output of the uname -a and any other info that might help us faster.

Moderator: mike

Post Reply
guillaume.vilar
Posts: 5
Joined: Mon Mar 02, 2020 12:52 pm

Unable to authenticate through API - Slim Exception

Post by guillaume.vilar » Sat Jun 27, 2020 1:06 pm

Hi guys,

I just upgraded a bare-metal server from 2.0.3-86 to 2.0.3-110.
From the UI perspective, everything works as expected, I am able to login and run labs.

However, I am not able to use the API calls to authenticate to the server. I get a Slim application error:

Code: Select all

curl -c cookie -b cookie -X POST -H "Content-type: application/json" -d '{"username":"testing1","password":"eve"}' http://1.1.1.1/api/auth/login

<html><head><title>Slim Application Error</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{display:inline-block;width:65px;}</style></head><body><h1>Slim Application Error</h1><p>The application could not run because of the following error:</p><h2>Details</h2><div><strong>Type:</strong> ErrorException</div><div><strong>Code:</strong> 2</div><div><strong>Message:</strong> file_get_contents(http://127.0.0.1/html5/api/tokens): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error
</div><div><strong>File:</strong> /opt/unetlab/html/includes/functions.php</div><div><strong>Line:</strong> 1073</div><h2>Trace</h2><pre><div>#0 [internal function]: Slim\Slim::handleErrors(2, 'file_get_conten...', '/opt/unetlab/ht...', 1073, Array)</div><div>#1 /opt/unetlab/html/includes/functions.php(1073): file_get_contents('http://127.0.0....', false, Resource id <div>#122)</div><div>#2 /opt/unetlab/html/includes/api_authentication.php(114): updateUserToken(Object(PDO), 'testing1', '149')</div><div>#3 /opt/unetlab/html/api.php(121): apiLogin(Object(PDO), Object(PDO), Array, '5f0fe9d1-f238-4...')</div><div>#4 [internal function]: {closure}()</div><div>#5 /opt/unetlab/html/includes/Slim/Route.php(468): call_user_func_array(Object(Closure), Array)</div><div>#6 /opt/unetlab/html/includes/Slim/Slim.php(1357): Slim\Route->dispatch()</div><div>#7 /opt/unetlab/html/includes/Slim/Middleware/Flash.php(85): Slim\Slim->call()</div><div>#8 /opt/unetlab/html/includes/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()</div><div>#9 /opt/unetlab/html/includes/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()</div><div>#10 /opt/unetlab/html/includes/Slim/Slim.php(1302): Slim\Middleware\PrettyExceptions->call()</div><div>#11 /opt/unetlab/html/api.php(1339): Slim\Slim->run()</div><div>#12 {main}</pre></body></html>
I copied that message to a text and here is how it renders in a web browser:
Screenshot 2020-06-27 at 14.00.14.png
Does someone have any idea how I can fix that?

Cheers,

Guillaume
You do not have the required permissions to view the files attached to this post.
Last edited by guillaume.vilar on Tue Jun 30, 2020 7:52 am, edited 2 times in total.

Uldis (UD)
Posts: 5081
Joined: Wed Mar 15, 2017 4:44 pm
Location: London
Contact:

Re: Unable to authenticate through API - Slim Exception

Post by Uldis (UD) » Sat Jun 27, 2020 2:20 pm


Post Reply