Hi there,
after the user has added the first google account, a repeated generateAuthUrl does no longer ask for new credentials. I have clients who have multiple google accounts and would like to integrate all of them, how do I fix/work around this limitation?
Greetings! You want to set prompt: 'select_account' in the options for generateAuthUrl. You can read about this option here:
https://developers.google.com/identity/protocols/OAuth2WebServer#creatingclient
And you can see a full OAuth2 example here:
https://github.com/google/google-auth-library-nodejs/blob/master/examples/oauth2.js
And you need to do something like this:
const authorizeUrl = oAuth2Client.generateAuthUrl({
access_type: 'offline',
scope: 'https://www.googleapis.com/auth/plus.me',
prompt: 'select_account'
});
Hope this helps!
Most helpful comment
Greetings! You want to set
prompt: 'select_account'in the options for generateAuthUrl. You can read about this option here:https://developers.google.com/identity/protocols/OAuth2WebServer#creatingclient
And you can see a full OAuth2 example here:
https://github.com/google/google-auth-library-nodejs/blob/master/examples/oauth2.js
And you need to do something like this:
Hope this helps!