我将firebase用作angular的后台,我使用http请求与firebase进行通信,
页面刷新后,我想保留登录状态
doGoogleLogin() {
return new Promise<any>((resolve, reject) => {
const provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('profile');
provider.addScope('email');
this.afAuth.auth
.signInWithPopup(provider)
.then(res => {
resolve(res);
firebase.auth().currentUser.getIdToken().then((tok) => {
this.token = tok;
});
});
});
}