我已经使用弹出 UX 模式为 Firebase 上托管的 React 网站实现了“使用 Google 登录”。我可以登录,但是,每次登录 localhost:3000 或网站的部署版本时,都会收到以下错误:
Cross-Origin-Opener-Policy policy would block the window.postMessage call.
我已尝试按照此处详细说明设置跨源开启器策略。在设置过程中,我的 firebase.json 文件如下所示:
{
"database": {
"rules": "database.rules.json"
},
"functions": {
"predeploy": ["npm --prefix \"$RESOURCE_DIR\" run lint"],
"source": "functions"
},
"hosting": [
{
"target": "sandbox",
"public": "build",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html",
"headers": [
{
"key": "Cross-Origin-Opener-Policy",
"value": "same-origin-allow-popups"
}
]
}
],
"headers": [
{
"source": "**",
"headers": [
{
"key": "Cross-Origin-Opener-Policy",
"value": …
Run Code Online (Sandbox Code Playgroud) firebase reactjs cross-origin-opener-policy sign-in-with-google