Laravel Passport在Vue/Axios API调用中突然返回401 [英] Laravel Passport suddenly returning 401 on Vue/Axios API calls

查看:81
本文介绍了Laravel Passport在Vue/Axios API调用中突然返回401的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序具有我从JavaScript/Vue前端使用的API.最近,我(不相关)试图取消对Valet的安全保护,以便共享该站点来执行Webhook测试.我收到了Brew无法确定链接的PHP"错误.长话短说,我恢复了符号链接,更新了作曲家的依赖关系,并重新保护了代客,以确保一切都没有发生.

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.

在加载我的应用程序时,所有对Laravel Passport安全API的调用都返回401.我的单元测试都通过了,因此非JavaScript身份验证有效.

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.

laravel_token x-csrf-token 都在请求标头中发送,我的内核中仍然有 CreateFreshApiToken 中间件.php.

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?

推荐答案

如果您最近才升级到Laravel 5.6.30,则这是一个具有重大更改的安全补丁.

If you've just recently upgraded to Laravel 5.6.30, this was a security patch with breaking changes.

在此处阅读升级说明.

TL; DR

AppServiceProvider

这篇关于Laravel Passport在Vue/Axios API调用中突然返回401的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆