Login CLI command reference
Authenticates against the Sanity.io API or a third-party identity provider via SAML SSO (Business / Enterprise plan feature).
USAGE
$ sanity login
FLAGS
--open Open a browser window to log in (`--no-open` only prints URL)
--provider=<PROVIDER> Log in using the given provider
--sso=<SSO> Log in using Single Sign-On, using the given organization slug
DESCRIPTION
Authenticates the CLI for access to Sanity projects
EXAMPLES
Log in using default settings
sanity login
Log in using Single Sign-On with the "my-organization" slug
sanity login --sso my-organization
Login with GitHub provider, but do not open a browser window automatically
sanity login --provider github --no-openThe sanity login process requires a browser. To run a command that requires authentication but where a browser is not available, such as on a server, you can login locally, run sanity debug --secrets to get a personal auth token, and then precede the command requiring authentication with SANITY_AUTH_TOKEN=<token>.
SANITY_AUTH_TOKEN=ab97ae7...0f9ff sanity init -y \ --create-project "Movies Unlimited" \ --dataset moviedb \ --visibility private \ --template moviedb \ --output-path /path/to/folder
Login with SAML SSO
SAML SSO Prerequisites
SAML SSO requires an organization with a business or enterprise plan and an external identity provider that supports SAML authentication, such as Okta, Azure AD, or Google.
Users configured with SAML SSO can use the --sso flag when logging in to pass their slug and log into a project using their third-party identity provider. The slug is set via the Sanity Management Console and is configured under the Settings tab for the Organization.
usage: sanity login --sso <slug> Authenticates against a third-party identity provider