Happening this week! Hear how Amplitude built a self-serve marketing engine to drive growth 🚀

Login

Authenticates against the Sanity.io API or a third-party identity provider via SAML SSO (Business / Enterprise plan feature).

usage: sanity login

   Authenticates against the Sanity.io API

The 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

Was this article helpful?