1
我將firebase更新爲「firebase」:「^ 4.2.0」。似乎用戶的對象屬性已更改。npm更新後無法登錄Firebase
const loginGG =() => {
try {
firebase.initializeApp(clientCredentials)
} catch (e) {
console.log('firebase is already created')
}
return firebase.auth().signInWithPopup(new firebase.auth.GoogleAuthProvider())
.then(result => {
if(!result || !result.user) throw new Error('LOGIN ERROR')
const token = result.user.ze;
const user = result.user;
Cookies.set('tapId', token);
Cookies.set('tapUser', JSON.stringify(user));
history.go(-1);
return {
user,
token
}
})
.catch(function(error) {
console.log(error);
return {}
});
}
,所以我改變 'result.user.ie' 到 'result.user.ze'。我知道還有另一種方法來生成令牌,因爲在firebase文檔中他們會說'使用User.getToken()「。我嘗試過,沒有成功。也許有人經歷過它可以幫助我?