'Allow only Google Workspace accounts with Google OAuth SSO
I'm using Google OAuth SSO to authenticate users to my website.
How do I show only Google Workspace (GSuite) accounts inside the Google "Choose an account" screen, instead of showing all Google accounts (gmail)?
Like the website https://www.g2.com/authorize did
Thanks, Shahar
Solution 1:[1]
I found the solution.
When redirecting the user to the https://accounts.google.com/o/oauth2/auth/oauthchooseaccount url, you should add the query param hd=* and as a result Google would show only Google workspace accounts. However, the user still can manually enter a gmail account.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
