dreamfactorysoftware / dreamfactory

DreamFactory API Management Platform
https://www.dreamfactory.com
Apache License 2.0
1.56k stars 314 forks source link

NetworkError: 401 Unauthorized #7

Closed meiti closed 9 years ago

meiti commented 9 years ago

Hi

I have installed dreamfactory 2 directly from GitHub on wamp. After re-running "php artisan migrate" and "php artisan db:seed" at the install root and creating System Admin User, I get following error when I want to login:

Browser POST http://localhost/api/v2/user/session response:

{"error":{"context":null,"message":"Invalid credentials supplied.","code":401,"trace":["0 C:\wamp\www \dsp2\vendor\dreamfactory\df-core\src\Resources\UserSessionResource.php(90): DreamFactory\Core\Resources\UserSessionResource->handleLogin(Array, false)","1 [internal function]: DreamFactory\Core\Resources\UserSessionResource->handlePOST()" ... }

dreamfactory.log file:

[2015-10-19 21:21:06] local.DEBUG: Resource event: user.session.post.pre_process
[2015-10-19 21:21:06] local.DEBUG: Resource event: system.admin.session.post.pre_process
[2015-10-19 21:21:06] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Maximum function nesting level of '100' reached, aborting!' in C:\wamp\www\dsp2\vendor\tymon\jwt-auth\src\Validators\ValidatorInterface.php:3 Stack trace:

0 C:\wamp\www\dsp2\bootstrap\cache\compiled.php(2088): Symfony\Component\Debug\Exception\FatalErrorException->__construct()

1 C:\wamp\www\dsp2\bootstrap\cache\compiled.php(2083): Illuminate\Foundation\Bootstrap\HandleExceptions->fatalExceptionFromError()

2 C:\wamp\www\dsp2\bootstrap\cache\compiled.php(0): Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()

3 C:\wamp\www\dsp2\vendor\composer\ClassLoader.php(301): Composer\Autoload\includeFile()

...

df-arif commented 9 years ago

If you are logging in using your admin user then use this API

POST http://localhost/api/v2/system/admin/session

For more info see http://wiki.dreamfactory.com/DreamFactory/Tutorials/Logging_in

meiti commented 9 years ago

I had this issue when I logged in through browser (localhost/dreamfactory/dist/#/login). In firebug I get following errors:

NetworkError: 401 Unauthorized - http://localhost/api/v2/user/session NetworkError: 500 Internal Server Error - http://localhost/api/v2/system/admin/session

df-arif commented 9 years ago

Sorry, I thought you were calling that API using a rest client. If you are simply launching the admin app on the browser then the admin app already takes care of the API calls. The app basically uses both APIs - user/session and system/admin/session. If your user is an admin the first call to user/session will fail using 401 Unauthorized but the second call to system/admin/session should work.

So, I took a second look at your log message above and noticed this - 'Maximum function nesting level of '100' reached, aborting!'. This error message is commonly produced by the php-xdebug extension. Your wamp installation most likely came with the xdebug extension. In your php.ini there is a setting called _xdebug.max_nestinglevel that can set this max nesting level. Change this setting to some higher number like 200. That should solve your problem. You can find more about this here - http://xdebug.org/docs/basic and here - http://stackoverflow.com/questions/8656089/solution-for-fatal-error-maximum-function-nesting-level-of-100-reached-abor

meiti commented 9 years ago

Thanks. Increasing Xdebug's max_nesting_level does indeed fix this issue.