Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
961 views
in Technique[技术] by (71.8m points)

service worker - PWA - SignInWithPopup doesn't work in my Angular app

I'm using signinWithPopup for Google login in my Angular app and everything works fine. It looks like this:

  doGoogleLogin(){
    return new Promise<any>((resolve, reject) => {
      let provider = new firebase.auth.GoogleAuthProvider();
      provider.addScope('profile');
      provider.addScope('email');
      this.afAuth
      .signInWithPopup(provider)
      .then(res => {
        this.router.navigate([{outlets: {modal: null}}], { queryParamsHandling: 'merge', relativeTo: this.activatedRoute.parent}).then(()=>{
        this.notificationService.showSuccess('Logged In', 'You are now logged in.');
      }); // NAVIGATES BACK TO WWW.MYAPP.COM
      }, err => {
        // console.log(err);
      })
    })
  }

However, it doesn't work in my PWA version of it that I have installed on Android. Popup with 'Sign in - Google Accounts' opens, I click on my mail address, and it redirects me to myapp.firebaseapp.com/_auth/handler?state=AMBjfrojirjETC (the page is hosted on firebase) - however, the page is blank and doesn't get redirected to www.myapp.com (in web app everything works fine). When I close it, I'm back in my PWA and the login didn't happen. It's my first PWA and have no idea what goes wrong.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...