Passport Package returning “Unauthenticated” Error

2019-08-19 17:37发布

问题:

I am using Passport Package for the API requests. It was working fine with my old server and the request was authenticated but since I have moved my application to a newer server I am receiving Invalid Token Error. Been searching on the google from last 2 days but didn't find any solution.

The API successfully returning me the token but when I am using that token to authenticate the user it gives me "Unauthenticated" error and redirects me to Home.

Everything is working fine on my old server. Not sure what to change to get this working. Any help will be appreciated.

回答1:

Check webServer probably it does not forward auth headers to php backend RewriteEngine On RewriteCond %{HTTP:Authorization} .+ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]



回答2:

Try to create new client credentials

php artisan passport:client --password

Or regenerate the keys

php artisan passport:keys --force