angulargoogle-oauthgoogle-signingoogle-identitygoogle-one-tap

Google one tap login popup pops even if user is signed in


Angular 16

I want to block/disable google's one tap login popup when user is already logged in.

I get login popup on whenever I refresh or save changes in code(auto reload) until I manually close it by clicking on close button.

I am using angularx-social-login package and login user through GoogleSigninButtonModule button and SocialAuthService.

app.module.ts

providers: [
    {
      provide: 'SocialAuthServiceConfig',
      useValue: {
        autoLogin: false,
        providers: [
          {
            id: GoogleLoginProvider.PROVIDER_ID,
            provider: new GoogleLoginProvider(
              myclientid
            )
          }
        ]
      } as SocialAuthServiceConfig,
    }
  ]

app.component.ts

import { SocialAuthService, SocialUser } from '@abacritt/angularx-social-login';

@Component...
export class AppComponent{

constructor(private socialAuthService: SocialAuthService) {
  }

ngOnInit() {
   this.socialAuthService.authState.subscribe({
      next:
        (user: SocialUser) => {
          if (user != null) {
            //My Logic
          }
        },
      error:
        () => {
        }
    })
  }
}

app.component.html

<asl-google-signin-button size='large' class="google-button" type="standard" text="continue_with" width="400"></asl-google-signin-button>

Solution

  • I know this is old but I fixed this by adding { oneTapEnabled: false } to the SocialAuthServiceConfig

    provide: 'SocialAuthServiceConfig',
      useValue: {
        autoLogin: false,
        providers: [{
          id: GoogleLoginProvider.PROVIDER_ID,
          provider: new GoogleLoginProvider('<ID>', { oneTapEnabled: false })
        }]