Skip to content
Last updated

Sanity integration

Sanity is a headless content platform with a structured content lake and a real-time editing environment. Integrating Sanity with Frontegg lets your application read and write documents, run GROQ queries, publish and schedule content releases, browse earlier document revisions, and manage datasets and assets on behalf of your users — all through Frontegg's integration layer. You can authenticate with either a Sanity project API token (recommended and self-serve) or OAuth 2.0.


Prerequisites

Connect to Sanity with an API token

Sanity authenticates API requests with a project token, sent on every request as the Authorization: Bearer <token> header. You create the token in Sanity Manage and choose its permission level.

Step 1: Open API tokens

Sign in to Sanity Manage, open your project, and go to the API tab → Tokens. Click Add API token.

Sanity project API Tokens page with the Add API token button

Step 2: Create the token

Fill in the token details:

  • Name — A descriptive name, for example Frontegg Integration.
  • Permissions — Choose a role that matches the access you need. Editor or Developer grant read and write access (read+write); Viewer is read-only.

Click Save and copy the token value.

Copy your token now

The token value is shown only once, when it is created. Copy it immediately and store it securely — treat it like a password. If it is exposed or lost, delete it and create a new one on the same Tokens page.

Sanity Add API token form with a name and the Editor permission selected

Use OAuth instead

Sanity's OAuth 2.0 is not self-serve — credentials are issued manually and only to Sanity technology partners. If Sanity has already issued you a Client ID and Client Secret, enter those instead of a project token. Everyone else should use the API token flow above. For the OAuth flow you also need your Frontegg Redirect URL — see How to get your Redirect URL.

Configure the Frontegg portal

Configure the integration in the Frontegg portal using the method you chose:

  1. Open the Frontegg portal and navigate to [ENVIRONMENT] → Integrations → Sanity.
  2. For an API token, paste it into the API Token field. For OAuth, enter the Client ID and Client Secret instead.
  3. Click Save.

You configure the credential only — the project and dataset are supplied per request, so a single integration can reach every project the token has access to.

The token or OAuth grant provides the following access:

ScopeDescription
readRead access to content
writeWrite access to content

Keep your credentials secure

Never share or commit your API token or Client Secret to version control.

Additional resources