Uncaught (in promise): Login providers not ready yet. Are there errors on your console?

4.4k Views Asked by At

I'm new to angular, currently implementing Google Sign-In(OAuth). I'm encountering this issue whenever I'm authenticating with Google. Sharing my login and logout functionality. Currently using Angular Social Login i.e Google Login.

signInWithGoogle(): void {
    this.authService.signIn(GoogleLoginProvider.PROVIDER_ID).then((data) => {
      console.log(data);
    }).catch(data => {
      this.authService.signOut();
      this.router.navigate(['login']);
    });
signOut(): void {
    this.authService.signOut().then((data) => {
      this.router.navigate(['login']);
    }).catch((data) => {
    });
  }
1

There are 1 best solutions below

0
Melaku Minas Kasaye On

This worked for me.

 googleLoginOptions = {
  scope: 'profile email'
}; // https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2clientconfig

  

signInWithGoogle(): void {
    this.authService.signIn(GoogleLoginProvider.PROVIDER_ID, this.googleLoginOptions ).then((data) => {
      console.log(data);
    }).catch(data => {
      this.authService.signOut();
      this.router.navigate(['login']);
    });

Refer: https://www.npmjs.com/package/angularx-social-login