Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception": "Infrastructure\\Auth\\Exceptions\\InvalidCredentialsException #43

Closed
flik opened this issue Apr 4, 2018 · 8 comments
Closed

Comments

@flik
Copy link

flik commented Apr 4, 2018

Post: /login giving response

{
  "status": "error",
  "code": 0,
  "message": "",
  "exception": "Infrastructure\\Auth\\Exceptions\\InvalidCredentialsException in /mnt/hgfs/app/my-api/infrastructure/Auth/LoginProxy.php:85\nStack trace:\n#0 /mnt/hgfs/app/my-api/infrastructure/Auth/LoginProxy.php(48): Infrastructure\\Auth\\LoginProxy->proxy('password', Array)\n#1 /mnt/hgfs/app/my-api/infrastructure/Auth/Controllers/LoginController.php(24): Infrastructure\\Auth\\LoginProxy->attemptLogin('esben@esben.dk', '1234')\n#2 [internal function]: Infrastructure\\Auth\\Controllers\\LoginController->login(Object(Infrastructure\\Auth\\Requests\\LoginRequest))\n#3 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(55): call_user_func_array(Array, Array)\n#4 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(44): Illuminate\\Routing\\Controller->callAction('login', Array)\n#5 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Infrastructure\\Auth\\Controllers\\LoginController), 'login')\n#6 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Route.php(160): Illuminate\\Routing\\Route->runController()\n#7 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(572): Illuminate\\Routing\\Route->run()\n#8 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))\n#9 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))\n#10 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(574): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))\n#11 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(533): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))\n#12 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(511): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))\n#13 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))\n#14 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))\n#15 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))\n#16 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))\n#17 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))\n#18 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))\n#19 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))\n#20 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))\n#21 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))\n#22 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))\n#23 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))\n#24 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))\n#25 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))\n#26 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))\n#27 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))\n#28 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))\n#29 /mnt/hgfs/app/my-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))\n#30 /mnt/hgfs/app/my-api/public/index.php(53): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))\n#31 {main}",
  "line": 85,
  "file": "/mnt/hgfs/app/my-api/infrastructure/Auth/LoginProxy.php"
}
@Versoo
Copy link

Versoo commented Apr 17, 2018

@flik are you sure that you sent request with good credentials? I use that and works fine, i have response with access_token.

@Dokujin
Copy link

Dokujin commented Apr 28, 2018

@Versoo i'm having the same issue on my ubuntu 16.04, locally it works just fine tho for more info i'm using your fork @Versoo

@luislora-es
Copy link

Same issue on high sierra. Credentials are correct.

@Versoo
Copy link

Versoo commented May 9, 2018

Hi guys, maybe it's dumb question but do you have Passport Clients keys in .env and in Database ?What do you use to test your api? I'm using Postman and my request looks that: http://prntscr.com/jflktk and headers http://prntscr.com/jfll8z

My test server works on Vagrant with Ubuntu 14.04.5 LTS. I installed many version of this repository and I didn't have problems.

@luislora-es
Copy link

Thank you! In my case not a dumb question. In my .env file i had

PERSONAL_CLIENT_ID=1
PERSONAL_CLIENT_SECRET=secret
PERSONAL_CLIENT_ID=2
PERSONAL_CLIENT_SECRET=secret

I change it to PASSWORD and works fine.

@julienmiclo
Copy link

If you have already launch artisan serve. Laravel create some files in bootstrap/cache. Delete all and relaunch your serve

@bolivir
Copy link

bolivir commented Apr 12, 2019

If you rerun the db migrations you also need to generate the passport secrets (artisan passport:install)
Otherwise these wont match and you get the InvalidCredentialsException.

So make sure you see the tokens match in youre env file and in the db table oauth_clients.

@esbenp
Copy link
Owner

esbenp commented May 24, 2019

Make sure once you have done your migration you install passport and copy the secrets to the .env file. So

1. php artisan migrate
2. php artisan passport:install
3. Copy the secrets from the output into the .env file

See readme for more information

@esbenp esbenp closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants