【发布时间】:2020-02-05 15:01:24
【问题描述】:
我尝试设置 Firebase 身份验证,并且在 localhost 上它也可以正常工作。但是在我在 Firebase 上获取应用程序后,我收到错误 auth/unauthorized-domain。
我已经查看了 Firebase,并且该域已列入白名单。
我使用 Google 登录 Firebase 的代码:
const provider = new auth.GoogleAuthProvider();
await this.afAuth.auth.signInWithPopup(provider)
.then ( credential => {
return this.updateUserData(credential.user);
})
private updateUserData(user) {
const userRef: AngularFirestoreDocument<User> = this.afs.doc(`users/${user.uid}`);
const data = {
uid: user.uid,
email: user.email,
displayName: user.displayName,
photoURL: user.photoURL
};
return userRef.set(data, { merge: true });
}
这是完整的错误信息:
code: "auth/unauthorized-domain"
message: "This domain (nutrimap-c4d12.web.app) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -
【问题讨论】:
-
如果您认为您已正确完成所有操作,但未按预期方式工作,请直接联系 Firebase 支持以获取故障排除帮助。 support.google.com/firebase/contact/support
-
感谢您的提示,我会尝试的。
标签: angular firebase firebase-authentication