Auth0 Home Blog Docs

Gatsbyjs and Auth0

auth0

#1

I’m interested in using Auth0 with Gatsbyjs. Anyone here with experience of this?


#2

I confess that I don’t have practical experience with Gatsby, but from what I understood from reading the documentation any integration with an authentication service (Auth0 or other) would be mostly independent of Gatsby itself. In other words, after having used it to generate the static content the authentication requirement that you would want to apply to a subset of that static content would depend only on the server-side technology stack that you would decide to use to serve up that content.

For example, going with Node.js and an Express server you would have configure Express to require authentication on the routes associated with the protected static content. This would then cause anonymous users to be redirected to a login page where they could authenticate. Upon successful authentication the Node.js server would receive a token/assertion proving that the user authenticated and using this token/assertion it could start a server-side session based on cookies. Subsequent request would be allowed due to the cookie.

In conclusion, you may want to take Gatsby out of the equation when researching the authentication approach and instead focus on the server-side technology that would be serving the protected content.


#3

Thanks @jmangelo. I will look more closely at their docs. I’ve used node/express in the past, so I have a feel for that.


#4

Thanks @jmangelo. I will look more closely at their docs. I’ve used node/express in the past, so I have a feel for that.


#5