SAML SSO enables your organization to control access to Sanity projects by using a third-party identity provider, such as Okta or Google. When you enable SAML (Security Assertion Markup Language) SSO (Single Sign-on), users who log into a project studio or the management interface will need to sign up and create an account using the SAML SSO flow, which redirects them through the identity provider before creating an account. Once they log in, they will be assigned a default role as defined in the organization's identity and security settings.
- An organization with a business or enterprise plan
- An external Identity Provider which supports SAML authentication (e.g., Okta or Google)
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. Under General Settings, you'll be able to define a unique slug that will serve to identify your organization in certain SSO workflows, such as logging in via CLI or logging into the project management console.
Your organization slug must:
- Be globally unique
- Be between 1-20 characters long
- Start with an alphanumeric character
- Contain no other characters than
With your organization slug set, move on to the SAML SSO settings found in the left sidebar menu. Once there, click the button aptly labeled "Create" to start setting up a new provider. This will generate the necessary details you need to connect your identity provider with your organization on Sanity.io.
Make sure you have at least one active project on either enterprise or business plan in your organization, or this menu item will be unavailable!
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 button to put the correct strings on the clipboard. It's also possible to inspect the SAML XML file.
Be aware that different providers may use different terminology. Shown here is the interface for entering these details if you're using Okta.com. Note that “callback URL” is called “Single sign on URL.”
Note the mapping of attributes for user accounts. Sanity requires
lastName to be mapped to corresponding values from the identity provider.
displayName are optional.
Make sure to set what groups in the external identity provider have access to the integration.
Having set up the external identity provider with the parameters you obtained from Sanity, it is now time to do the reverse. In your Sanity settings, click the button labeled
Configure. You should be presented with the following dialog. Go ahead and fill in the appropriate values.
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.
After saving your settings, you will probably want to enable SSO for one or several of your projects. In the process, you'll also set a default role for new accounts created through this identity provider. The default role can be changed at any point at your convenience.
Before setting up your studio to use the new SSO setting, make sure everything is working as expected by visiting the link provided and log in to your project management console. Copy-paste the Sanity manage 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.
Next, you'll want to update your studio to show the login screen from your SSO identity provider. In your studio project, locate the file
config/@sanity/default-login.json and edit it to match the code provided. You have to restart your studio after saving your edits to see the new login screen.
If you'd like to keep the default login methods in addition to your new SAML SSO on your login screen, change
"append" on line 3!
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.
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.
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.