gpt4 book ai didi

firebase - Firebase 中的自定义 authDomain

转载 作者:行者123 更新时间:2023-12-04 11:48:35 34 4
gpt4 key购买 nike

我正在为 SPA 使用 Firebase 的内置 oAuth 功能。
foobar.com 说,这个 SPA 位于它自己的域中

问题是,当oauth弹出窗口打开时,使用的是旧的foobar.firebaseapp.com域,而不是新的foobar.com

我的 init 看起来像这样

firebase.initializeApp({
apiKey: '...',
authDomain: 'foobar.firebaseapp.com',
databaseURL: 'https://foobar.firebaseio.com',
storageBucket: 'foobar.appspot.com',
messagingSenderId: '123456'
})

我猜 authDomain 可能与它有关,但是如果我将其更改为 foobar.com,则会出现错误:
 code: "auth/popup-closed-by-user", message: "The popup has been closed by the user before finalizing the operation."}

简而言之,是否有一种方法可以为 Firebase 自定义 oAuth url?

最佳答案

authDomain依赖于该域上可用的特定脚本。如果您的单页应用托管在具有自定义域的 Firebase 托管上,您将能够使用该域作为 authDomain .

或者,您可以在域的子域上为 Firebase 托管设置自定义域,例如auth.foobar.com然后你就可以使用 auth.foobar.com作为您的 authDomain .

目前不支持使用非 Firebase 托管域作为您的 authDomain .

关于firebase - Firebase 中的自定义 authDomain,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40856179/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com