首页 > 解决方案 > 发生 Firebase 身份验证错误

问题描述

我正在使用 firebaseui 方法在 vuejs 中进行 firebase 身份验证。但我收到此错误

Could not find the FirebaseUI widget element on the page. 

这是我的代码

var config = {
apiKey: "some api key",
authDomain: "sample-1234.firebaseapp.com",
databaseURL: "https://sample-1234.firebaseio.com",
projectId: "sample-1234",
storageBucket: "sample-1234.appspot.com",
messagingSenderId: "123456789",
clientId: "2565985323215244u7hf3lc6k.apps.googleusercontent.com"
};
var app = firebase.initializeApp(config);
var auth = app.auth(); 
var uiConfig = {
signInSuccessUrl: 'http://localhost:8080/',
signInOptions: [{
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
}],
tosUrl: '<your-tos-url>'
};
var ui = new firebaseui.auth.AuthUI(auth);
console.log(ui);
ui.start('#firebaseui-auth-container', uiConfig);

标签: node.jsfirebasevue.jsfirebase-authentication

解决方案


推荐阅读