问题
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
来源:https://stackoverflow.com/questions/50674552/passport-package-returning-unauthenticated-error