Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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) => {
    });
  }
like image 832
Jack Sengar Avatar asked Oct 16 '25 02:10

Jack Sengar


1 Answers

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

like image 183
Melaku Minas Kasaye Avatar answered Oct 18 '25 00:10

Melaku Minas Kasaye



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!