Auth API
The Studio can be configured to use your own login solution rather than the standard ones by supplying the auth provider details in your studio configuration.
Custom authentication can be configured for the studio or individual workspaces. This is done by configuring the root config key auth
for the studio or workspace with a configuration object that adheres to the AuthConfig signature. Additional details and configurations can be found in the documentation on Migrating Custom Auth Providers.
import {defineConfig} from 'sanity'
export default defineConfig({
..., // The rest of the other studio config.
auth: {
projectId: 'dsf3cqw',
dataset: 'production',
mode: 'replace',
redirectOnSingle: false,
providers: [
{
name: 'enterprise-sso',
title: 'My Enterprise SSO',
url: 'https://my-enterprise.com/login',
},
],
},
})
Gotcha
In studio versions prior to v3.15.0 the recommended way to configure custom authentication included using the createAuthConfig
helper method. This approach will still work, but is considered deprecated in favor of the more straight forward new method.