Skip to main content

Sign in with Google

Your end users can sign in to your app with their Google account instead of a password. It is a per-flow switch on the default identity provider: you turn it on for your patient flow, your practitioner flow, or both. Your app's integration does not change. Users still go through the same authorize URL, and the token they come back with is the same token a password sign-in issues.

Google sign-in is off for every flow until you turn it on.

Turning it on​

You can switch it from the dashboard or through the configuration API. Both change the same setting.

In the dashboard​

  1. Open your project and go to API Integration.
  2. Under Authentication, find the card for the user flow (Patient or Practitioner).
  3. Tick Sign in with Google. The change saves immediately; there is no Save button.

You need the Project Admin role. If the card shows Restricted to: followed by domain names, only Google accounts from those domains can sign in (see Restricting to your organisation's domains). Domains can be set only through the API.

Through the configuration API​

With a project API key that has the config:write scope:

PATCH /config/v1/connection HTTP/1.1
Host: api.medbackend.com
Authorization: Bearer <project API key>
X-Project-ID: 3fa85f64-5717-4562-b3fc-2c963f66afa6
Content-Type: application/json

{
"entity_type": "Patient",
"upstream_providers": ["google"]
}
  • entity_type names the flow: Patient or Practitioner.
  • upstream_providers is ["google"] to turn Google on and [] to turn it off. google is the only accepted value.
  • upstream_allowed_domains (optional) is a list of domains. See below.
  • Each list you send replaces the stored list. A field you leave out is not changed.

The response is the same document GET /config/v1/connection returns (that call needs config:read). Each entry in user_flows carries upstream_providers and upstream_allowed_domains, so you can read the current state back.

Unlike rule changes, this setting takes effect immediately. It does not wait for a publish.

StatusMeaning
200Saved and applied
422The values were refused. detail says why: an unknown provider, a malformed domain, more than 20 entries, a repeated value, a flow the project does not have, or values the platform refused
502The outcome is unknown: the change may or may not have been applied. Read GET /config/v1/connection before retrying

Restricting to your organisation's domains​

upstream_allowed_domains limits Google sign-in to accounts managed by your organisation's Google Workspace:

{
"entity_type": "Practitioner",
"upstream_allowed_domains": ["clinic.example"]
}
  • An empty list ([], the default) accepts any Google account.
  • A non-empty list accepts only Google Workspace accounts whose organisation domain is on the list. Personal Gmail accounts are refused.
  • Each entry must be a lowercase domain name such as clinic.example. Up to 20 entries.

A domain restriction is usually what you want on a practitioner flow. On a patient flow it is usually not.

What your users see​

The sign-in page shows a Continue with Google button above the password form. Google then shows its own account chooser. After that, one of these happens:

SituationWhat the user gets
The Google account is new to this flow, and the flow allows sign-upAn account is created and the user is signed in. They have no password; they can set one later with password reset
The Google address already has an account on this flowA Confirm it's you page asks for that account's password, once. After that, Google signs them in directly
The flow is invitation-onlySign-up through Google works only from the link in the invitation e-mail, and only with the invited address. Without one: "… is invitation-only. Open the invitation link from your e-mail to sign up."
The flow does not allow sign-up and there is no account"No account for this email. Ask … for an invitation."
Google has not verified the address"Google has not verified this email address."
The account's domain is not on your allowed list"… accepts only accounts from its own organisation."
The account is disabled"This account cannot sign in."
More than one account matches the address, differing only in letter case"Please contact … to sign in."

… is your flow's name.

An existing account is never taken over by e-mail address alone. Matching an address is not enough: the user must prove they own the account by entering its password. The same applies to invitations, which need the token from the e-mail link.

A link is undone when the account's password or e-mail address changes. The next Google sign-in asks for the password again.

The token​

A token issued after a Google sign-in is the same token a password sign-in issues: the same claims, the same one-hour lifetime. Nothing in it says how the user signed in, so your app and your access rules need no change.

Turning it off again​

Remove google from upstream_providers, or untick the box. The button disappears and Google sign-ins are refused from then on. Accounts are kept. A user whose account was created through Google has no password and needs to use password reset to sign in again.

Sessions that already exist are not ended. Access tokens stay valid for up to an hour, and refresh tokens already issued keep working for their full lifetime (seven days by default). To end a user's session sooner, disable their account.

Your privacy notice​

When Google sign-in is on, Google learns that this person signs in to your app. That is a disclosure to a third party, and your privacy notice must cover it. No health data is sent to Google. Google receives a sign-in request and returns the user's identity.

What is kept about the Google account: its Google account identifier, the fact that it is linked to this user, and when. The user's name and e-mail address are taken from Google when the account is created through Google. Nothing else from Google is stored.

Suggested wording, to adapt with your own counsel:

If you choose to sign in with Google, Google is told that you are signing in to [app name], and shares your basic profile (including your name), e-mail address and Google account identifier with us. We store the identifier to recognise you next time. We do not send any of your health information to Google. Google's handling of this information is governed by Google's privacy policy.