> ## Documentation Index
> Fetch the complete documentation index at: https://docs.masivo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Identity providers

> Configure an OAuth app for Firebase, Google, Auth0, Supabase, Cognito or Microsoft

Any OpenID Connect provider works as long as it signs ID tokens with
asymmetric keys (RS256 or ES256) published in a JWKS. The dashboard ships
presets for the six below. Read [Integrate with OAuth](https://docs.masivo.ai/api-reference/guides/integrate-with-oauth.md)
first.

Every provider follows the same steps:

**1. Get the issuer and audience**

Copy them from the provider console. They must equal the `iss` and `aud`
of a real ID token; decode one at [jwt.io](https://jwt.io) to check.

**2. Create the OAuth app**

Go to **Settings → OAuth → Apps → New app**, pick the provider preset and
replace every `<placeholder>`.

**3. Choose the Customer ID claim**

Keep `sub` or use a custom claim. Its value may only contain letters,
digits, `_` and `-`.

**4. Create the customers**

From your backend, create each customer in Masivo with the claim's value
as its ID.

**5. Exchange the ID token**

After sign-in, call `POST /api/storefront/v1/oauth/exchange` with the ID
token.

| Provider | Issuer | Audience | `sub` works as customer ID |
| - | - | - | - |
| Firebase | `https://securetoken.google.com/<project-id>` | `<project-id>` | Yes (Firebase UID) |
| Google | `https://accounts.google.com` | `<client-id>.apps.googleusercontent.com` | Yes (numeric ID) |
| Auth0 | `https://<tenant>.auth0.com/` | `<client-id>` | **No** (`auth0\|abc123`) |
| Supabase | `https://<project-ref>.supabase.co/auth/v1` | `authenticated` | Yes (user UUID) |
| Amazon Cognito | `https://cognito-idp.<region>.amazonaws.com/<user-pool-id>` | `<app-client-id>` | Yes (user UUID) |
| Microsoft Entra ID | `https://login.microsoftonline.com/<tenant-id>/v2.0` | `<application-id>` | Yes (per-app ID) |

***

## Firebase

**Values.** Firebase Console → **Project settings → General → Project ID**.
The same value goes in both fields.

* Issuer: `https://securetoken.google.com/my-project`
* Audience: `my-project`
* JWKS URL: empty

Every sign-in method enabled in **Authentication → Sign-in method** (email,
Google, Apple…) issues the same Firebase ID token, so one OAuth app covers
them all.

**ID token.**

```ts theme={null}
// React Native (@react-native-firebase/auth)
const idToken = await auth().currentUser?.getIdToken();

// Web (firebase/auth)
const idToken = await getAuth().currentUser?.getIdToken();
```

**Testing without an app.** Use the REST API with the Web API key from
Project settings. The response's `localId` is the UID to create the customer
with.

```bash theme={null}
curl -s "https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=$FIREBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"jane@example.com","password":"***","returnSecureToken":true}'
```

**Custom claim.** Set it from your backend with the Admin SDK, then set
**Customer ID claim** to `masivo_customer_id`. The claim shows up once the
token refreshes, so call `getIdToken(true)`.

```ts theme={null}
await admin.auth().setCustomUserClaims(uid, { masivo_customer_id: "cust_123" });
```

***

## Google

Use this preset for Sign in with Google **without** Firebase. With Firebase,
use the Firebase preset: the token your app gets is Firebase's.

**Values.** Google Cloud Console → **APIs & Services → Credentials → OAuth
2.0 Client IDs**.

* Issuer: `https://accounts.google.com`
* Audience: `1234567890-abc.apps.googleusercontent.com`

The audience is the client the token was issued for. On Android and iOS,
Google Sign-In issues it for the **Web client ID** you pass as `webClientId`
/ `serverClientId`, not the Android or iOS client.

**ID token.** `@react-native-google-signin/google-signin`:
`(await GoogleSignin.signIn()).data?.idToken`. On the web, the `credential`
returned by Google Identity Services.

**Testing without an app.** In the [OAuth 2.0 Playground](https://developers.google.com/oauthplayground)
authorize the `openid email` scopes and copy the `id_token`. Its audience is
the Playground's own client ID. Revoke the Playground's access at
[myaccount.google.com/permissions](https://myaccount.google.com/permissions)
afterwards.

**Custom claim.** Google doesn't support custom claims; use `sub`.

> [!WARNING]
>
> Some Google ID tokens carry `iss: accounts.google.com`, without `https://`.
> The issuer must be an `https` URL, so those tokens fail with `invalid_grant`.

***

## Auth0

**Values.** Auth0 Dashboard → **Applications → your app → Settings**:
**Domain** and **Client ID**.

* Issuer: `https://my-tenant.us.auth0.com/` (keep the trailing slash; with a
  custom domain, `https://login.example.com/`)
* Audience: the Client ID

**ID token.** `react-native-auth0`:
`(await auth0.credentialsManager.getCredentials()).idToken`. On the web
(`@auth0/auth0-spa-js`): `(await auth0.getIdTokenClaims())?.__raw`.

**Custom claim (required).** Auth0's `sub` looks like `auth0|abc123` and `|`
is not allowed in a customer ID. Add a claim with a post-login **Action**:

```js theme={null}
exports.onExecutePostLogin = async (event, api) => {
  const id =
    event.user.app_metadata.masivo_customer_id ??
    event.user.user_id.replace(/[^a-zA-Z0-9_-]/g, "_");
  api.idToken.setCustomClaim("https://masivo.ai/customer_id", id);
};
```

Set **Customer ID claim** to `https://masivo.ai/customer_id`.

***

## Supabase

**Values.** Supabase Dashboard → **Project Settings → General → Project ID**
(the project ref).

* Issuer: `https://abcdefghijklmnop.supabase.co/auth/v1`
* Audience: `authenticated`
* JWKS URL: `https://abcdefghijklmnop.supabase.co/auth/v1/.well-known/jwks.json`

> [!WARNING]
>
> The project needs asymmetric **JWT signing keys** (Project Settings → JWT
> Keys). Projects that only have the legacy HS256 JWT secret publish no keys,
> and the exchange fails with `invalid_grant`.

**ID token.** Supabase has no separate ID token; exchange the session's
access token: `(await supabase.auth.getSession()).data.session?.access_token`.

**Custom claim.** Add `masivo_customer_id` with a **Custom Access Token
Hook** (Authentication → Hooks).

***

## Amazon Cognito

**Values.** AWS Console → **Cognito → User pools → your pool**: the **User
pool ID** (`us-east-1_AbC123`) and its region. Under **App clients**, the
**Client ID**.

* Issuer: `https://cognito-idp.us-east-1.amazonaws.com/us-east-1_AbC123`
* Audience: the app client ID

**ID token.** Use the ID token, not the access token: Cognito access tokens
have no `aud`. With Amplify:
`(await fetchAuthSession()).tokens?.idToken?.toString()`.

**Custom claim.** Create the `custom:masivo_id` attribute, let the app client
read it, and set **Customer ID claim** to `custom:masivo_id`. A *Pre token
generation* trigger works too.

***

## Microsoft Entra ID

**Values.** Azure Portal → **Microsoft Entra ID → App registrations → your
app → Overview**: **Application (client) ID** and **Directory (tenant) ID**.

* Issuer: `https://login.microsoftonline.com/<tenant-id>/v2.0`
* Audience: the Application (client) ID

Multi-tenant apps (`common`, `organizations`) get a different `iss` per
tenant, so they need one OAuth app per tenant.

**ID token.** MSAL: `result.idToken` from `loginPopup` or
`acquireTokenSilent`, with the `openid` scope.

**Which claim.** `sub` differs for each app registration. If several apps
must reach the same customer, use `oid` (the user's ID in the tenant). For
your own ID, add an optional claim or extension attribute under **Token
configuration**.

***

## Other providers

Okta, Keycloak, Clerk, Apple and other OIDC providers work when:

* the issuer is a public `https` URL that serves
  `/.well-known/openid-configuration`, or you set a public `https` JWKS URL;
* tokens are signed with RS256 or ES256, not an HS256 secret;
* the chosen claim only contains letters, digits, `_` and `-`.

Clerk user IDs (`user_2abc…`) work as is. Apple's `sub` contains dots, so it
needs a custom claim or Firebase in front.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.