【发布时间】:2017-09-27 17:19:18
【问题描述】:
谷歌的身份验证工作正常,如用户名和密码,但是当谷歌登录发生时,标题功能工作缓慢,用户名和密码登录工作正常?这是什么原因?
signInByEmail(email,password) {
return this.afAuth.auth.signInWithEmailAndPassword(email, password)
.then(
(success)=> {
this.afAuth.auth.currentUser.getIdToken()
.then(token => {
let params = new URLSearchParams();
params.set('tsid', `Bearer ${token}`);
this.auth.setToken(token);
});
localStorage.setItem('emailUser', email);
this.router.navigateByUrl('/');
}
).catch(
(err)=> {
this.showAlert();
console.log(err);
}
);
}
signInByGoogle(){
return this.afAuth.auth.signInWithPopup(new firebase.auth.GoogleAuthProvider()).then(
(success)=> {
this.afAuth.auth.currentUser.getIdToken()
.then(token => {
let params = new URLSearchParams();
params.set('tsid', `Bearer ${token}`);
this.auth.setToken(token);
});
localStorage.setItem('emailUser', JSON.stringify(success.user.email));
this.router.navigateByUrl('/');
}
).catch(
(err)=> {
console.log(err);
}
);
}
app-root中有HostBending
export class AppComponent implements OnInit {
@HostBinding('class.layout-fixed') get isFixed() { return this.settings.layout.isFixed; };
}
【问题讨论】:
标签: angular firebase firebase-authentication