Auth0 Home Blog Docs

Securing Gatsby with Auth0

auth0
react
gatsby
#1

In this tutorial, you’ll learn how to set up Auth0 for authentication and identity management on a GatsbyJS site.

Brought to you by @sam.julien :man_technologist:t2:

Read on :v:>> https://auth0.com/blog/securing-gatsby-with-auth0

#2

I’d love to hear how you’re using Gatsby!

#3

This is great, If i wanted to secure the whole site with auth0, whats the best way to do that?

1 Like
#4

Hi David, thanks! You would just use the same approach and have the logic that’s in the account component in whatever your home component will be. And you’d most likely have a “login” button that would trigger the Auth0 authorization. Everything else would basically be the same though (the auth utility, the silent auth, etc). Hope that helps!

#5

Thanks.

I’m looking to protect the whole gatsby site (without the option to login/logout on click) if that makes sense? Would it be best to wrap auth0 stuff in layout.js or higher?

#6

Ah, I see. Well, in that case, you’d probably want to modify wrapRootElement so that it handles both log in and silent auth.