google/google-api-javascript-client

Authorization code flow keeps prompting consent screen users

alejo-webel opened this issue · 2 comments

Summary
I'm using the authorization code flow as the sign in method in my Angular web app and i'm finding that after every login, the consent screen is always shown, no matter if it is the Nth sign in attempt of a same user.

According to the google documentation, I understand that this consent screen should only appear once per user (After the first token request).

Expected Behavior
The consent screen should only appear once per user.

Actual Behavior
The consent screen is appearing every time while signing in.

Code (Simplified sample)

var googleClient

function initGoogle(): void {

googleClient = google['accounts'].oauth2.initCodeClient({
          client_id: 'XXX',
          ux_mode: 'popup',
          scope:
            'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email',
          callback: ({ code }) => {
            myAuthCodeHandler(code);
          },
        });
        
}

function triggerAuthorizationFlow(): void {

googleClient.requestCode();

}

And I'm importing the google gsi client at my head tag:

<script src="https://accounts.google.com/gsi/client" async defer></script>

Does anybody is having the same issue? I need to keep using the authorization code flow but with the expected beehaviour mentioned above.

Thanks

experiencing the same thing