Skip to content

fredjens/auth0-sanity-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auth0 and Sanity

Proof of Concept

Install
1. Add your own .env (from .env.examplef)
2. Add your Sanity credentials to sanity/sanity.json
3. yarn install
Run
yarn dev 🚀

The flow

  1. The frontend request login directly from Auth0.
  2. The frontend reciews a callback containing the session token.
  3. The frontend calls our backend using the session token.
  4. The backend validates the token using the Auth0 API.
  5. If the user is valid we search Sanity to find the user.
  6. Return the userdata 🎉

Applications

/frontend

The frontend is the offical Auth0 react sample app. The only thing added is a hook that calls our /backend which again calls Sanity to get the user data.

/backend

The backend is a Node/Express application, it has one route that take a request and returns the userdata is the user is authenticated correctly:

/sanity

The Sanity config and Studio. We are using a private dataset for the userdata and an API key.

About

Authenticate with Auth0 and use Sanity for userdata

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published