
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeSanity itself does not provide end-user authentication for your application's users to register and login. This is an important distinction that often confuses people when first exploring Sanity.
Sanity's authentication system is designed for content creators and editors who need to access Sanity Studio or manage content. The authentication features you'll find in the docs (like API tokens, SAML SSO, and the deprecated third-party login) are all about managing who can access your Sanity project and Studio - not your website visitors.
If you need authentication for your website or app visitors (like a membership site, user profiles, or gated content), you'll need to use a separate authentication service. Here's the recommended approach:
Integrate an authentication service like:
These services handle user registration, login, password resets, and session management for your end users.
Once you have authentication set up, you can:
Store user-specific data in Sanity: After a user authenticates with your auth provider, you can create or update documents in Sanity with their information using a server-side API call with a write token
Restrict content based on user status: In your frontend, check the user's authentication status before displaying certain content fetched from Sanity
User-generated content: Use Sanity Functions (serverless compute within Sanity) or serverless endpoints to accept authenticated user submissions and write them to Sanity. Functions are the modern, recommended approach for handling this kind of automation.
Here's a common pattern:
// Your frontend (after user logs in with Auth0/Firebase/etc)
const userToken = await authProvider.getToken()
// Call your backend/serverless function or Sanity Function
await fetch('/api/create-user-content', {
method: 'POST',
headers: { 'Authorization': `Bearer ${userToken}` },
body: JSON.stringify({ content: 'user data' })
})
// Your backend validates the user token and writes to Sanity
// using a Sanity API token with write permissionsWhile there isn't a specific Sanity guide for end-user authentication (because it's outside Sanity's scope), you might find these resources helpful:
Sanity is not an auth provider - it's a content platform. You'll need to pair it with a dedicated authentication service for your end users. This separation of concerns is actually a strength of the composable/headless CMS approach, as you can choose the best authentication solution for your specific needs while using Sanity to manage and deliver your content.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store