问题
My application has an API that I consume from my JavaScript/Vue front end. Recently, I (unrelated) tried to unsecure Valet in order to share the site to perform webhook tests. I received a Brew 'Unable to determine linked PHP' error. Long story short I restored the symlink, updated composer dependencies and resecured Valet to ensure nothing was broken.
Upon loading my application, all calls to my Laravel Passport secured API are returning 401. My unit tests are all passing, so the non-javascript authentication is working.
Both the laravel_token
and the x-csrf-token
are being sent in the request header and I still have CreateFreshApiToken
middleware in my Kernel.php.
Has anyone got any ideas as to where I can start to look to debug this?
回答1:
If you've just recently upgraded to Laravel 5.6.30, this was a security patch with breaking changes.
Read upgrade notes here.
TL;DR
Call Laravel\Passport\Passport::withoutCookieSerialization()
in your AppServiceProvider
来源:https://stackoverflow.com/questions/52172790/laravel-passport-suddenly-returning-401-on-vue-axios-api-calls