使用自定义域的 Firebase 身份验证 - 选择我的 google 帐户后出现空白页面
Firebase Authentication using a custom domain - Blank page after selecting my google account
我正在为我的网络应用程序使用 Firebase 身份验证,并为 Firebase 身份验证的 Google 登录功能自定义重定向域,以便 Google 的身份验证页面将显示 Continue to: mydomain.io
,
- 域名托管
Firebase Hosting
Cloudflare config
- 将
auth.mydomain.io
添加到 Firebase 控制台中的授权域列表
Firebase console authorized domains
- 在 Google OAuth 设置页面中,将
https://auth.mydomain.io/__/auth/handler
重定向页面的 URL 列入白名单
Google OAuth client
- 编辑我应用的 JavaScript 代码:
const firebaseConfig = {
...
authDomain: "auth.mydomain.io",
...
}
运行 我的本地应用程序,我可以看到我的域已正确链接到我的应用程序。
Login: Continue to mydomain.io
但是,当我 select 要连接到 Google 帐户时,没有任何反应。在弹出窗口中,我被重定向到 auth.mydomain.io
,其中有一个空白页面和顶部的无限加载栏
编辑:我在使用 Facebook OAuth 时也遇到了同样的问题
After selecting the account
大约 10 秒后,弹出窗口自行关闭,我在本地应用程序控制台中收到以下错误:
FirebaseError: Firebase: Error (auth/popup-closed-by-user).
at createErrorInternal (assert.ts:122:1)
at _createError (assert.ts:83:1)
at popup.ts:283:1
当我为 authDomain
属性 将应用程序的 JavaScript 配置更改为 myapp.firebaseapp.com
时,它工作正常,我可以使用我的 google 帐户登录
const firebaseConfig = {
...
authDomain: "myApp.firebaseapp.com",
...
}
带着好消息回来了。 它现在可以完美运行,尽管我没有做任何更改。
如果你和我一样,给它 24-48 小时。
我正在为我的网络应用程序使用 Firebase 身份验证,并为 Firebase 身份验证的 Google 登录功能自定义重定向域,以便 Google 的身份验证页面将显示 Continue to: mydomain.io
,
- 域名托管
Firebase Hosting
Cloudflare config
- 将
auth.mydomain.io
添加到 Firebase 控制台中的授权域列表
Firebase console authorized domains
- 在 Google OAuth 设置页面中,将
https://auth.mydomain.io/__/auth/handler
重定向页面的 URL 列入白名单
Google OAuth client
- 编辑我应用的 JavaScript 代码:
const firebaseConfig = {
...
authDomain: "auth.mydomain.io",
...
}
运行 我的本地应用程序,我可以看到我的域已正确链接到我的应用程序。
Login: Continue to mydomain.io
但是,当我 select 要连接到 Google 帐户时,没有任何反应。在弹出窗口中,我被重定向到 auth.mydomain.io
,其中有一个空白页面和顶部的无限加载栏
编辑:我在使用 Facebook OAuth 时也遇到了同样的问题
After selecting the account
大约 10 秒后,弹出窗口自行关闭,我在本地应用程序控制台中收到以下错误:
FirebaseError: Firebase: Error (auth/popup-closed-by-user).
at createErrorInternal (assert.ts:122:1)
at _createError (assert.ts:83:1)
at popup.ts:283:1
当我为 authDomain
属性 将应用程序的 JavaScript 配置更改为 myapp.firebaseapp.com
时,它工作正常,我可以使用我的 google 帐户登录
const firebaseConfig = {
...
authDomain: "myApp.firebaseapp.com",
...
}
带着好消息回来了。 它现在可以完美运行,尽管我没有做任何更改。 如果你和我一样,给它 24-48 小时。