Auth0 Home Blog Docs

Securing Gatsby with Auth0


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:>>


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


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

1 Like

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!



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?


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