Sanity logosanity.ioAll Systems Operational© Sanity 2026
Change Site Theme
Sanity logo

Documentation

    • Overview
    • Platform introduction
    • Next.js quickstart
    • Nuxt.js quickstart
    • Astro quickstart
    • React Router quickstart
    • Studio quickstart
    • Build with AI
    • Content Lake
    • Functions
    • APIs and SDKs
    • Agent Actions
    • Visual Editing
    • Blueprints
    • Platform management
    • Dashboard
    • Studio
    • Canvas
    • Media Library
    • App SDK
    • Content Agent
    • HTTP API
    • CLI
    • Libraries
    • Specifications
    • Changelog
    • User guides
    • Developer guides
    • Courses and certifications
    • Join the community
    • Templates
Developer guides
Overview

  • Develop with AI

    Best practices

  • Query optimization

    Paginating with GROQ
    High performance GROQ

  • Roles and authentication

    Setting up Single Sign-On with SAML
    Third-Party Login (Deprecated)
    OAuth2
    Set up SSO authentication with SAML and Azure/Entra ID
    Set up SSO authentication with SAML and PingIdentity
    Set up SSO authentication with SAML and JumpCloud
    Reconcile users against internal systems
    Restrict Access to Specific Documents
    Setting up a Default Relay State for IdP Initiated - SAML Logins

  • Structured content

    Scalable navigation patterns
    An opinionated guide to Sanity Studio
    Browsing Content How You Want with Structure Builder
    Deciding on fields and relationships
    Create richer array item previews
    Dynamic folder structure using the currentUser and workflow states
    Create a time duration object field
    Level up Your Edit Modal with Next/Previous Navigation Buttons for Array Items
    Create a “coupon generator” string field input
    Managing redirects with Sanity
    Create a document form progress component
    Create an array input field with selectable templates
    Creating a Parent/Child Taxonomy
    Create interactive array items for featured elements
    Create a visual string selector field input
    Create a survey rating number field input
    How to use structured content for page building
    Create a recycling bin for deleted documents via Sanity Functions

  • Frontend integration

    Add live content to your application
    Forms with Sanity
    Vercel Integration
    Build your blog with Astro and Sanity
    How to implement front-end search with Sanity

  • Ecommerce

    Displaying Sanity content in Shopify
    Sanity Connect for Shopify
    Custom sync handlers for Sanity Connect

  • Integrating with other services

    A/B testing with Sanity and Growthbook
    Cookie consent integrations with Sanity
    Integrating external data sources with Sanity
    Klaviyo (email campaigns)
    Developing with Next.js on GitHub Codespaces

  • Adopting Sanity

    How to pitch Sanity.io to your team
    Convincing your clients to go with Sanity.io, rather than a traditional CMS
    Not-profit plan
    Agencies: Navigating the Spring 2025 Organization Changes
    How to generate massive amounts of demo content for Sanity
    How to implement Multi-tenancy with Sanity

  • GROQ

    GROQ-Powered Webhooks – Intro to Filters
    GROQ-Powered Webhooks – Intro to Projections

  • Portable Text

    Presenting Portable Text
    Add Inline blocks for the Portable Text Editor
    Beginners guide to Portable Text
    How to add custom YouTube blocks to Portable Text
    Converting Inline Styles to Sanity Block Decorators
    Add things to Portable Text
    Change the height of the PTE

  • Community and ecosystem

    Create your own Sanity template
    Community guides
    Community Code of Conduct
    Contribute to the ecosystem

  • Plugin development

    Migrating plugins to support Content Releases

On this page

Previous

High performance GROQ

Next

Third-Party Login (Deprecated)

Was this page helpful?

On this page

  • Introduction
  • Prerequisites
  • Setting up Single Sign-On with SAML
  • 1. Create a new SAML SSO configuration for your organization
  • 2. Use the details presented to configure the external identity provider
  • 3. Configure the SAML service provider with the settings of the external identity provider
  • 4. Name your configuration and set options for role mapping
  • 5. Set a slug for your organization
  • 6. Enable SSO and configure role mapping for the desired project(s)
  • 7. Test your configuration by attempting to login
  • 8. Configure the studio to use the new SSO provider
  • 9. Verify by logging in with SSO
Developer guidesLast updated January 9, 2026

Setting up Single Sign-On with SAML

This article will take you through the process of setting up SAML (Security Assertion Markup Language) SSO (Single Sign-on) for your organization.

Introduction

SAML SSO enables your organization to control access to Sanity projects by using a third-party identity provider, such as Okta, Google, or Azure Active Directory. When you enable SAML (Security Assertion Markup Language) SSO (Single Sign-on), users who log into a project through studio or the management interface, will be authenticated through the organization’s identity provider. Once they log in, they will be assigned roles according to rules based on group membership from their user record in the identity provider.

Prerequisites

  • An organization with a project on Enterprise plan or Growth plan with the SAML SSO add-on.
  • An external Identity Provider which supports SAML authentication (e.g., Okta, Google, or Azure AD).
  • Organization administrator permissions.

Setting up Single Sign-On with SAML

1. Create a new SAML SSO configuration for your organization

Access your organization's settings by going to sanity.io/manage and select the appropriate organization in the dropdown menu in the upper left corner. Then select the SAML SSO section in the left sidebar, and click the button to create a SAML SSO provider.

Gotcha

SAML SSO is available only for Enterprise plan or Growth plan with SAML SSO add-on.

Read more about our plans and pricing options

A new dialog will appear informing you that SAML SSO has not yet been configured. Click the button labeled Configure to start setting up your provider. This will generate the details needed to connect your identity provider with your organization on Sanity.io.

Loading...

2. Use the details presented to configure the external identity provider

The process of configuring SAML SSO starts with Sanity providing you with the necessary details for setting up your external identity provider. You can use the copy buttons to put the correct strings on the clipboard. It's also possible to download the settings as a SAML XML file.

Loading...
The numbered fields in this image map to the corresponding fields in the next

Be aware that different providers may use different terminology. Shown here is the interface for entering these details if you're using Okta.com. If you're using Azure AD, please also see the guide to set up SSO authentication with SAML and Azure. Note that “callback URL” is called “Single sign on URL.”

Loading...
The numbered fields in this image map to the corresponding fields in the previous

Note the mapping of attributes for user accounts. Sanity requires email, firstName, and lastName to be mapped to corresponding values from the identity provider. id and displayName are optional.

Gotcha

Make sure to set the groups in the external identity provider that should have access to the integration.

3. Configure the SAML service provider with the settings of the external identity provider

Having set up the external identity provider with the parameters you obtained from Sanity, it is now time to do the reverse. Scroll down to the next section with the heading Your Identity Provider details. Go ahead and fill in the appropriate values.

Protip

Many providers will let you download the required settings as an XML file. If you have such a file, click on the top right button labeled Upload new metadata to save yourself some tedious copy/pastes.

Loading...

4. Name your configuration and set options for role mapping

Scroll to the next section to give your configuration a meaningful name, and choose whether or not to automatically update roles whenever a user logs in. You may also set the length of user sessions to your liking before saving your configuration.

Automatically update roles

If the option to automatically update roles is selected, the mapping of roles will happen every time a user logs in using the project-specific login url. This will also disallow manual management of roles.

Loading...

5. Set a slug for your organization

At the bottom of the SAML SSO configuration page you'll be able to define a unique slug that will identify your organization in certain SSO workflows, such as logging in via CLI or logging into the project management console. Note that this setting can also be accessed under General settings, and might therefore already have a value set.

Your organization slug must:

  • Be globally unique
  • Be between 1-20 characters long
  • Start with an alphanumeric character
  • Contain no other characters than a-z, 0-9 and -
Loading...
# Example CLI login using the slug 'saml-docs'
sanity login --sso saml-docs

6. Enable SSO and configure role mapping for the desired project(s)

After saving your settings you are ready to move on and enable SSO for one or several of your projects. In the process, you’ll also configure role mapping for each project.

Loading...

This is a paid feature

This feature is available as an addon for the Growth plan.

In the role mapping dialog, you’ll set a default fallback role which will be applied to users who don’t belong to any groups matching your mapping rules, as well as rules to map groups from your SSO provider to roles in this project. Role mapping rules are evaluated against the group membership attribute of the user identity on the identity provider, and they support regular expression syntax (observe back references and lookahead assertions are not supported). A few examples are listed below:

  • editors will match exactly editors
  • .*-admin will match news-admin, sales-admin, -admin and so forth
  • [aA]dmin will match admin & Admin
Loading...

7. Test your configuration by attempting to login

Before setting up your studio to use the new SSO setting, make sure everything is working as expected by visiting the project-specific link provided and log in to your project management console. Copy-paste the Sanity manage project-specific login URL into your browser's address bar. If correctly set up, this will log you out of your current account and into the user account given to you by your SSO identity provider. It might be convenient to test this in another browser.

Loading...

8. Configure the studio to use the new SSO provider

Next, you'll want to update your Studio to show the login screen from your SSO identity provider by using the Auth API. Instructions for both v3 and v2 studios can be found by expanding the dropdown labeled SAML SSO login for Sanity Studio.

Loading...

Protip

By default the code snippet will show how to add SAML SSO to the list of login options. If you want to replace the list of options entirely, change the value of mode from "append" to "replace".

9. Verify by logging in with SSO

Finally, verify that the configuration work as expected by logging in as a user from your identity provider. Your login screen should list only the appropriate options.

Loading...

After logging in at least once with SAML SSO, you may want to check your organization's members in the management interface. You'll see a visual indicator on each member's avatar indicating what sign-in-method they use, allowing you to quickly make any adjustments – such as deleting or demoting accounts outside your identity provider domain.

Loading...

Gotcha

SAML SSO members will take up an additional seat towards your quota since they are considered individual users in Sanity. Checking your member list for duplicates is recommended after changing your identity provider.

Dialog informing the user that SAML SSO has not yet been configured
Shows the Sanity provider details screen with 4 fields highlighted with sequential integers from 1 to 4.. These are labeled "Sanity callback URL", "Sanity entity ID", "NameID Format" and "Attributes"
Shows the Okta SAML settings screen with 4 fields highlighted with sequential integers from 1 to 4. These are labeled "Single sign-on URL", "Audience URI (SP Entity ID", "Name ID Format" and "Attribute statements"
Show a section of the Sanity project management console labeled "General settings for SAML SSO across all projects". The following options can be set:  "Configuration name", "Auto update roles on login" and "Session TTL"
Shows the UI for specifying a slug for an organization
# Example CLI login using the slug 'saml-docs'
sanity login --sso saml-docs
Shows a list of projects belonging to an organization, both labeled as not having SAML SSO configured yet
A role mapping dialog with a default fallback role and three group names mapped to Sanity roles
Shows a dialog confirming that SAML SSO is activated and configured. Also shown is example code for setting up your studio for SAML SSO authentication.
Shows the Sanity Studio login screen with the following alternative for logging in: "Google", "Github", "E-mail / password", and "SAML"
Shows a list of users with different roles and different icons that reflect their chosen method of authentication