Connect Google
Sign in with Google, for any Google account or one Workspace organisation. Built and tested locally against a test provider.
State in this release
This is the OpenID Connect type with Google's facts filled in; read the OpenID Connect guide for mapping, linking, domains and the journey. It was tested locally against a provider that mimics Google's tokens. No real Google client was used, so Google's consent screen, verification requirements and quotas are untested here.
What the preset fixes
The issuer is https://accounts.google.com and any other issuer is refused. Scopes default to openid, email and profile. The person is the pair of Google's issuer and the account's sub, never an address.
- With hd set, the ID token's hd claim must equal it. A personal account has none and another organisation has a different one; both are refused.
- Without hd, every Google account can sign in, personal ones included. Decide on purpose.
- tenant_id is for Microsoft and is refused here.
Create the client and the connection
In the Google Cloud console create an OAuth client of type Web application and add the connection's callback_url as an authorized redirect URI. Then create the connection with the client id, the optional hosted domain and the secret.
Request · http
POST /v1/console/accounts/{account_id}/directories/{directory_id}/connections
Content-Type: application/json
X-Auth-Proof: <receipt, when the directory asks for one>
{
"strategy": "google",
"display_name": "Sign in with Google",
"config": {
"client_id": "123456789-abc.apps.googleusercontent.com",
"hd": "example.com"
},
"client_secret": "secret-from-google",
"jit_enabled": true
}Linking existing accounts
Google asserts email_verified. A Google sign-in attaches to an existing account only when the connection is trusted for email, the address domain has a verified claim on the connection and the person has no other federated identity. Set hd as well, so that only your organisation's Workspace accounts reach that rule. Otherwise nothing is attached on Google's word: the person proves the existing account first, or is refused when link_policy is never.
Enable and test
Enable the connection, then sign in with a Workspace test user, then with a personal account, which must be refused when hd is set. Disabling the connection ends the sessions it created and leaves other sign-in methods alone.