Skip to content

Sign in with Google

Matrix Authentication Service (MAS) can offer “Continue with Google” next to its own username and password. MAS acts as the OpenID Connect client; Google is the upstream provider. This needs a Google Cloud project, so it is optional.

  1. In the Google Cloud console, open APIs & Services → Credentials and create an OAuth client ID of type Web application.

  2. Add this authorised redirect URI:

    https://account.<serverName>/upstream/callback/<provider-id>

    <provider-id> is a ULID that you choose and keep stable (see below), for example 01KV19W10A7JVQ50S71FRKYCAR. Generate a new one for your install.

  3. Note the client ID and client secret.

Store the secret in a Kubernetes Secret instead of the values file:

Terminal window
kubectl -n vss create secret generic mas-google-oauth \
--from-literal=client_secret='<google-client-secret>'

Use the External Secrets Operator instead if you keep secrets in a store: declare the ExternalSecret under extraObjects in your values, targeting the Secret mas-google-oauth.

matrix-authentication-service:
upstreamOAuth2:
providers:
- id: 01KV19W10A7JVQ50S71FRKYCAR # your own ULID, stable
human_name: Google
brand_name: google
issuer: https://accounts.google.com
token_endpoint_auth_method: client_secret_post
client_id: "<google-client-id>"
client_secret_existing:
name: mas-google-oauth
key: client_secret
scope: "openid profile email"

Apply it with helm upgrade. MAS syncs the providers on startup; open https://account.<serverName>/ and you should see Continue with Google.

A literal client_secret: "..." also works, but it ends up in your values file. Use it only for development.

  • Redirect URI must match exactly, including the provider ID. A mismatch shows as redirect_uri_mismatch on Google’s page.
  • Removing a provider needs mas-cli config sync --prune inside the MAS pod. Deleting it from the values alone does not remove it.
  • Account mapping. By default the local part of the user’s email becomes the Matrix username (claims_imports changes this).
  • Admins. matrix-authentication-service.policy.adminUsers lists Matrix localparts that get admin rights, whatever login they use.
  • Other providers. The providers list takes any OpenID Connect provider. The chart also supports Sign in with Apple. Further MAS settings can be merged with matrix-authentication-service.additional.
  • Password sign-in stays available unless you disable it (matrix-authentication-service.passwords.enabled: false).