Skip to main content
Masivo issues short-lived OAuth 2.0 tokens (1 hour) with least-privilege access. There are two kinds of credentials, one per kind of caller: Both are created in Settings → OAuth and belong to an environment. Send the returned access_token as Authorization: Bearer <token> on every Storefront request.
Never ship an OAuth client secret inside a front end. Apps use the token exchange, which needs no secret.

OAuth clients (servers)

1

Create the client

Go to Settings → OAuth → Clients → New client. Pick an environment, a name and the scopes the integration needs (for example customers:read and events:write).
2

Copy the credentials

Copy the client_id (mv_…) and the client_secret (mvs_…). The secret is shown only once; Masivo only stores its hash. Use Rotate secret if it leaks.
3

Request a token

Use the client credentials grant:
Omit scope to get every scope of the client. Asking for a scope the client doesn’t have fails with invalid_scope.

Scopes

Scopes follow <resource>:read|write. read covers GET and HEAD; write covers every other method. The resource comes from the first path segment after /api/storefront/v1/. A path missing from this table is denied to every OAuth token. For example, POST /behavior/events needs events:write and GET /customers/{id} needs customers:read. A request without the needed scope gets 403 with Insufficient scope. Required: <scope>.

OAuth apps (front ends)

An OAuth app tells Masivo to trust the ID tokens of your identity provider. After the user signs in, your front end trades the provider’s ID token for a Masivo token that only reaches that customer’s own data (RFC 8693 token exchange):
See Identity providers for the values of Firebase, Google, Auth0, Supabase, Cognito and Microsoft.

App fields

How the exchange works

  1. Masivo reads iss and aud and finds the active OAuth apps with that issuer and audience.
  2. With several matches it uses the one whose alias equals the audience parameter.
  3. It verifies the signature with the provider keys, plus issuer, audience and expiry.
  4. It reads the Customer ID claim and signs a token with scope: CUSTOMER, customer_id, oauth_app_id and env.

What a customer token can do

On /customers/{id}, only when {id} is its own customer_id: Outside /customers it reaches the same paths as a CLIENT API key: behavior/events, behavior/events/bulk, inapp/capabilities, news-feed/capabilities, deeplinks/resolve, reviews and review-forms/*.
  • The profile PATCH only accepts name, dob, gender, document_type, document_number, country and phone.
  • Every event must carry the token’s customer_id, in bulk too.
  • PURCHASE and other trusted writes still need an OAuth client.

Customer ID claim

Masivo does not look customers up by email or any other field. It reads one claim of the ID token and uses its value, as is, as the Masivo customer ID. The Customer ID claim field holds the name of that claim, never a value. Why sub is the default. OpenID Connect defines sub as the stable, unique identifier of the user at the provider. Every provider sends it and it never changes when the user edits their profile. Don’t use email. Masivo customer IDs only allow letters, digits, _ and - (^[a-zA-Z0-9_-]+$), so an email never matches a customer. Emails also change, and some providers accept unverified ones. What this means for your customers. Each customer must exist in Masivo with the provider’s user ID as its ID. Create it from your backend (OAuth client with customers:write) when the user registers:
If your customers already have other Masivo IDs (for example cust_123), add a custom claim with that ID in your provider and set Customer ID claim to its name, for example masivo_customer_id.

Sharing a provider between accounts

A brand with one account per country often has a single Firebase project for all its apps. Each account can trust that provider with its own OAuth app:
  1. Only a user who belongs to every account that already trusts the issuer and audience can add it to another account. Otherwise the dashboard answers This issuer and audience belong to another account.
  2. Give each OAuth app a different Alias (for example brand-ec and brand-pe).
  3. Each front end sends its alias as audience in the exchange. Without it the exchange fails with invalid_request; Masivo never guesses the account.
Organizations don’t take part in this: each OAuth app belongs to one account.

Errors

Both endpoints answer standard OAuth errors ({ "error", "error_description" }): Tokens are valid until they expire (1 hour). Disabling a client or app, or rotating a secret, stops new tokens but doesn’t revoke tokens already issued.
The customer token exists only after the user signs in. Calls made before that (resolving deferred deep links, registering an install on first launch) still need a CLIENT API key.