How to force an account for a single user with Google OAuth 2.0?

Sometimes, when a user logs into a site with Google OAuth 2.0, they choose the wrong login account. This is usually not a problem if a user has more than one account registered in a browser, Google will automatically display the user selection screen: user selection screen

But if the user has only one account and logs in, this screen is skipped. Instead, I need the Google login bar to always display so that I can make sure that the user has the opportunity to try entering the correct account. I tried using approval_prompt = "force" , but this forces me to accept permissions, and not just show the login page. Google's one user login
How to make Google OAuth 2.0 always show the login screen?
(and never automatically skip it)

+5
source share
1 answer

Add the prompt=select_account to your authorization request.

This will cause the account selection to always be displayed, even if the user is only logged into one account. Users will be able to choose from their accounts or add new ones.

For example: https://accounts.google.com/o/oauth2/auth?redirect_uri=https%3A%2F%2Fdevelopers.google.com%2Foauthplayground&response_type=code&client_id=407408718192.apps.googleusercontent.com&scope=profile+email&line access select_account

+4
source

All Articles