我正在开发一个离子应用程序,我需要通过twitter登录。这是我几天前开发的,它工作得很好,但最近遇到了这个错误:
" Firebase :此域未授权用于您的Firebase项目的OAuth操作。请从Firebase控制台编辑授权域的列表。(auth/ authorized - domain )“。
signInWithRedirect() {
const auth = getAuth();
signInWithRedirect(auth, new TwitterAuthProvider())
.then(() => {
console.log(window);
return getRedirectResult(auth);
})
.then((result) => {
const credential = TwitterAuthProvider.credentialFromResult(result);
// This gives you a Google Access Token.
// You can use it to access the Google API.
const token = credential.accessToken;
// The signed-in user info.
const user = result.user;
this.user = user;
// ...
})
.catch((error) => {
// Handle Errors here.
const errorCode = error.code;
const errorMessage = error.message;
this.error = { errorCode, errorMessage };
});}
这是我的package.json文件。
"@angular/common": "~12.1.1",
"@angular/compiler": "~12.1.1",
"@angular/core": "~12.1.1",
"@angular/fire": "^7.0.3",
"@angular/forms": "~12.1.1",
"@angular/platform-browser": "~12.1.1",
"@angular/platform-browser-dynamic": "~12.1.1",
"@angular/router": "~12.1.1",
"@ionic-native/core": "^5.36.0",
"@ionic-native/deeplinks": "^5.36.0",
"@ionic-native/facebook": "^5.36.0",
"@ionic-native/firebase-authentication": "^4.20.0",
"@ionic-native/geolocation": "^5.20.0",
"@ionic-native/sign-in-with-apple": "^5.36.0",
"@ionic-native/twitter-connect": "^5.36.0",
"@ionic/angular": "^5.7.0",
"cordova-plugin-compat": "1.2.0",
"cordova-plugin-customurlscheme": "5.0.2",
"cordova-plugin-facebook-connect": "^3.1.1",
"cordova-plugin-inappbrowser": "5.0.0",
"cordova-universal-links-plugin-fix": "1.2.1",
"firebase": "^9.0.1",我还将localhost添加到我的授权域(默认情况下已添加):

我猜这是因为ionic应用的起源是"ionic://localhost“而不是"http://localhost"”。
我的离子版也是Firebase推荐的最新版本:https://firebase.google.com/docs/auth/web/cordova
这方面的任何帮助都将不胜感激。谢谢
发布于 2021-09-21 22:12:04
我认为授权域名部分中的本地主机域应该如下所示:http://localhost:4200
https://stackoverflow.com/questions/69183346
复制相似问题