Laravel Sanctum 登录不适用于移动 Safari [英] Laravel Sanctum Login not working on mobile Safari

查看:37
本文介绍了Laravel Sanctum 登录不适用于移动 Safari的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 VueJs 前端的 Laravel 项目和带有 Laravel sanctum 的 auth.一切正常,但一位用户无法使用他的 iPhone 和 iPad 登录.

I have a laravel project with VueJs frontend and auth with Laravel sanctum. Everything works fine, however one user can't login with his iPhone and iPad.

我告诉他取消选中阻止所有 cookie";功能,似乎他没有检查.

I told him to uncheck "Block all cookies" function and it seems that he didn't have that checked.

这可能是什么原因?

当我在多个 iOS 设备上测试时,我可以毫无问题地登录.

When I test it with multiple iOS devices I can login without any problem.

当我打开登录页面时,控制台中出现以下错误(仅在 Safari 中):

When I open the login page the following error appears (only in Safari) in the console:

内容安全策略指令script-src"的源列表包含无效源:strict-dynamic".它将被忽略.

The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored.

推荐答案

是的,Safari 仍然不支持 'strict-dynamic' 令牌,因此在控制台中发出警告.
这不是错误,而是警告.浏览器总是对此类事情发出警告,否则您将没有机会知道当前浏览器版本支持什么.

Yes, Safari still does not support 'strict-dynamic' token therefore warns about in the console.
It's not an error, but warning.Browsers always warn about such things, otherwise you have no chances to know what is supported in current browser version.

只需确保您的 CSP 处于浏览器向后战斗模式(有足够的资源可以在浏览器不支持某些令牌).看起来是这种情况,因为您检查了许多不同的浏览器.

Just ensure your CSP is in browsers backward combatibility mode (have enough sources to continue working when browsers do not support some tokens). It looks like this is the case as you have checked many different browsers.

无法使用 iPhone 和 iPad 登录的用户必须在控制台中检查 CSP 错误,然后才能开始跟踪正在发生的事情.或者,您可以使用 CSP 的报告工具(report-uri 指令)来检查登录页面上的浏览器中发生了哪些违规行为.

That user which can't login with his iPhone and iPad have to check CSP errors in the console, before start tracing whats going on. Alternatively you can use reporting facilities of CSP (report-uri directive) to check which violations occur in browsers on the login page.

这篇关于Laravel Sanctum 登录不适用于移动 Safari的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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