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

Fresh install 401 Unauthorized error on login #33

Open
dylanglockler opened this issue Aug 22, 2020 · 3 comments
Open

Fresh install 401 Unauthorized error on login #33

dylanglockler opened this issue Aug 22, 2020 · 3 comments

Comments

@dylanglockler
Copy link

I followed the instructions very carefully - twice in fact - but my login POST returns
http://lq.test/api/v1/oauth/token 401 (Unauthorized)

I tried digging in to figure it out, but the entire login process on this package is modified from the Laravel docs.

`POST http://lq.test/api/v1/oauth/token 401 (Unauthorized)

  dispatchXhrRequest @ xhr.js?b50d:178
  xhrAdapter @ xhr.js?b50d:12
  dispatchRequest @ dispatchRequest.js?5270:52
  Promise.then (async)    
  request @ Axios.js?0a06:61
  Axios. @ Axios.js?0a06:86
  wrap @ bind.js?1d2b:9
  _callee2$ @ AuthService.js?b012:8
  tryCatch @ runtime.js?96cf:45
  invoke @ runtime.js?96cf:274
  prototype. @ runtime.js?96cf:97
  asyncGeneratorStep @ asyncToGenerator.js?fa84:5
  _next @ asyncToGenerator.js?fa84:27
  eval @ asyncToGenerator.js?fa84:34
  F @ _export.js?63b6:36
  eval @ asyncToGenerator.js?fa84:23
  login @ AuthService.js?b012:8
  login @ Login.vue?d4ad:118
  _callee$ @ Login.vue?d4ad:111
  tryCatch @ runtime.js?96cf:45
  invoke @ runtime.js?96cf:274
  prototype. @ runtime.js?96cf:97
  asyncGeneratorStep @ asyncToGenerator.js?fa84:5
  _next @ asyncToGenerator.js?fa84:27
  Promise.then (async)    
  asyncGeneratorStep @ asyncToGenerator.js?fa84:15
  _next @ asyncToGenerator.js?fa84:27
  eval @ asyncToGenerator.js?fa84:34
  F @ _export.js?63b6:36
  eval @ asyncToGenerator.js?fa84:23
  submit @ Login.vue?d4ad:106
  invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1854
  invoker @ vue.runtime.esm.js?2b0e:2179
  invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1854
  Vue.$emit @ vue.runtime.esm.js?2b0e:3888
  click @ QBtn.js?9c40:154
  invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1854
  invoker @ vue.runtime.esm.js?2b0e:2179
  original._wrapper @ vue.runtime.esm.js?2b0e:6917

`

@dylanglockler
Copy link
Author

I have multiple installs with various modifications trying to get this package to work. On another i'm getting this error:
The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. {"userId":1,"exception":"[object] (Laravel\\Passport\\Exceptions\\OAuthServerException(code: 3): The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. at /Users/Dylan/Sites/app.wanderbird.life/vendor/laravel/passport/src/Http/Controllers/HandlesOAuthErrors.php:26)

Research seems to suggest it's an issue related to Refresh Token:
https://stackoverflow.com/questions/47928728/the-request-is-missing-a-required-parameter-includes-an-invalid-parameter-value

I notice also in this package that the AuthServiceProvider does not have Passport::routes() - and from reading that's required for using Passport with Laravel. Still trying to make this package work for my application - I really need Laravel 7 and Quasar working with hot reload!

@josergm86
Copy link

I have the same problems. Specifically, the problem that you reports of
"`POST http://lq.test/api/v1/oauth/token 401 (Unauthorized)"
is in the code line
$tokenResponse = parent::issueToken($server);
in the login function of the LoginController.

@Manfred047
Copy link
Owner

Manfred047 commented Aug 25, 2020

I have multiple installs with various modifications trying to get this package to work. On another i'm getting this error:
The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. {"userId":1,"exception":"[object] (Laravel\\Passport\\Exceptions\\OAuthServerException(code: 3): The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. at /Users/Dylan/Sites/app.wanderbird.life/vendor/laravel/passport/src/Http/Controllers/HandlesOAuthErrors.php:26)

Research seems to suggest it's an issue related to Refresh Token:
https://stackoverflow.com/questions/47928728/the-request-is-missing-a-required-parameter-includes-an-invalid-parameter-value

I notice also in this package that the AuthServiceProvider does not have Passport::routes() - and from reading that's required for using Passport with Laravel. Still trying to make this package work for my application - I really need Laravel 7 and Quasar working with hot reload!

you copied key values in?
PASSWORD_GRANT_CLIENT_ID
PASSWORD_GRANT_CLIENT_SECRET

key is generated on passport:install, if you need regenerate, use passport:install --force

i modified the passport routes, for working with SPA, check the auth.php on routes/api/auth.php

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

3 participants