当我尝试使用 facebook 按钮登录时如何避免此错误?

How to avoid this error when I try to implement sign in with facebook button?

我添加了 Facebook 登录按钮并在 https://localhost:3000/ 上一切正常,但是当我部署我的应用程序时,它在控制台中抛出以下错误:

Refused to load the script 'https://connect.facebook.net/en_US/sdk.js' because it violates the following Content Security Policy directive: "script-src-elem 'self' 'unsafe-inline' https://apis.google.com/ ".

我试图将这一行添加到我的 manifest.json 中:"content_security_policy": "script-src 'self' 'unsafe-inline' https://connect.facebook.net 'unsafe-eval'; object-src 'self'" 但这没有帮助。谁能给我解释一下这是什么问题?

because it violates the following Content Security Policy directive: "script-src-elem 'self' 'unsafe-inline'

此违规消息表示您在 CSP 中使用了 script-src-elem 指令。但是您将 https://connect.facebook.net 源添加到 script-src 指令中。
Chrome 浏览器会跟随 script-src-elem(如果出现),script-src 仅在 script-src-elem 被省略时用作回退。

您必须将 https://connect.facebook.net 添加到 script-src-elemscript-src 中。