I am relying on Google OAuth to authorize a user for a site I'm building. At the time I'm requesting permission, I already know which Google Account he wants to use (I'm using Google OAuth as a second level auth). However if the User is logged in to several Google Accounts at once, Google redirects the user to a SelectSession interface.
When the user is directed to https://accounts.google.com/o/oauth2/auth?... he ends on https://www.google.com/a/SelectSession. This is unnecessary, because I already know which session he wants to use.
Does anyone know a way to automatically select a specific account, so that the user does not need to manually select the session at https://www.google.com/a/SelectSession?
If you already know the user's email address you can add the query parameter user_id= as a hint. If the user is logged in as that account, it'll skip the account selection and go straight to the approval.
It doesn't guarantee the user will actually authorize with that account. Its just a hint and there are still opportunities for them to switch to a different account. If you need to know for sure which account they selected, you'd need to verify that afterwards (e.g. call the userinfo endpoint.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With