Connect Hasura with Auth0

In this part, you will learn how to connect Hasura with the Auth0 application that you just created in the previous step.

Before we do that, we need to secure our endpoint with an admin secret. Right now, the GraphQL endpoint is open and anybody can query and manage the data. Read docs on how to add an admin secret to a Hasura Cloud project.

Once an admin secret is added, we need to configure Hasura to use the Auth0 public keys. An easier way to generate the config for JWT is to use the following link - https://hasura.io/jwt-config/

jwt-config

The generated configuration can be used as the value for environment variable HASURA_GRAPHQL_JWT_SECRET.

Open the Hasura Cloud dashboard and head to the "Env vars" page for your Hasura Cloud project:

Hasura ENV Config

Click on + New Env Var to add a new environment variable.

Add a new Config Var called HASURA_GRAPHQL_JWT_SECRET, and copy and paste the generated JWT configuration into the value box.

You should end up with something like the following:

Add new env Cloud

Click on Add and your environment variable will be applied to the project.

Great! Now your Hasura instance is secured using Auth0.

Close

Get Started with GraphQL Now

Hasura Cloud gives you a fully managed, production ready GraphQL API as a service to help you build modern apps faster.
Ready to get started?
Start for free on Hasura Cloud or you could contact our sales team for a detailed walk-through on how Hasura may benefit your business.
Stay in the know
Sign up for full access to our community highlights, new features, and occasional baby animal gifs! Oh, and we have a strict no-spam rule. ✌️