abacritt / angularx-social-login

Social login and authentication module for Angular 17
630 stars 387 forks source link

add: [Google]prompt property on initTokenClient #588

Closed kattoshi closed 1 year ago

kattoshi commented 1 year ago

After signing in with Google, I wanted to omit the authentication screen and consent screen operations that are reopened when 'SocialAuthService::getAccessToken' is called. https://developers.google.com/identity/oauth2/web/reference/js-reference#TokenClientConfig

add 'prompt' in GoogleInitOptions.

  providers: [
    CookieService,
    {
      provide: 'SocialAuthServiceConfig',
      useValue: {
        autoLogin: true,
        providers: [
          {
            id: GoogleLoginProvider.PROVIDER_ID,
            provider: new GoogleLoginProvider('xxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com',
            {
              scopes : environment.auth.scopes,
              prompt : 'none'   // '' | 'none' | 'consent' |  'select_account'
            }
            ),
          }
        ]
      } as SocialAuthServiceConfig,
brandondunc94 commented 1 year ago

This is exactly what I need, can we get this merged? Currently the double prompt is preventing users from logging in on a mobile browser. The first prompt shows up to select the google account, and then a second prompt is shown when calling getAccessToken. On a mobile browser, the second prompt does not display for some reason. I would like to avoid the second prompt altogether.

brandondunc94 commented 1 year ago

I appreciate the quick action! This is working great for me.