【问题标题】:Firebase authentication with angular 2使用 Angular 2 进行 Firebase 身份验证
【发布时间】: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


    【解决方案1】:

    我找到了这个问题的答案 通过社交链接登录的按钮必须在标签内

    【讨论】:

      猜你喜欢
      • 2017-02-24
      • 2017-01-22
      • 1970-01-01
      • 2017-03-15
      • 2016-09-30
      • 2020-10-09
      • 2017-03-11
      • 2018-10-19
      • 1970-01-01
      相关资源
      最近更新 更多