Skip to content

Commit

Permalink
docs: better secret handling in Auth0 rule (hasura#5677)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuela authored Oct 1, 2020
1 parent b705dcb commit 3b57008
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/graphql/core/guides/integrations/auth0-jwt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ Using Auth0 Rules again, add the following rule which will insert a new user eve
function (user, context, callback) {
const userId = user.user_id;
const hasuraAdminSecret = "xxxx";
const url = "https://my-hasura-app.hasura.app/v1/graphql";
const upsertUserQuery = `
mutation($userId: String!){
Expand All @@ -244,7 +243,7 @@ Using Auth0 Rules again, add the following rule which will insert a new user eve
const graphqlReq = { "query": upsertUserQuery, "variables": { "userId": userId } }
request.post({
headers: {'content-type' : 'application/json', 'x-hasura-admin-secret': hasuraAdminSecret},
headers: {'content-type' : 'application/json', 'x-hasura-admin-secret': configuration.HASURA_ADMIN_SECRET},
url: url,
body: JSON.stringify(graphqlReq)
}, function(error, response, body){
Expand All @@ -253,6 +252,8 @@ Using Auth0 Rules again, add the following rule which will insert a new user eve
});
}
Make sure to specify the ``HASURA_ADMIN_SECRET`` variable in the "Rules > Settings" section of Auth0.

That’s it! This rule will be triggered on every successful signup/login and sync your Auth0 user into your postgres database.

.. note::
Expand Down

0 comments on commit 3b57008

Please sign in to comment.