It is possible to automate the below steps. However, Below are manual steps listed.
- Navigate to
https://manage.auth0.com/dashboard/
. If you do not have an auth0 account, create one under the free plan. - Create a new application on Auth0 (Singple Page Applications - SPA). If you have already created an application on Auth0 for GRANDstack, Skip this step.
- For
AUTH_DIRECTIVES_ROLE_KEY
, Under the application settings, Copy value ofDomain
underbasic information
. the domain informationhttps://<DOMAIN>/roles
- Visit settings under this application, Scroll to the bottom and select
Show Advanced Settings
. Advanced Settings
has various tabs. Under the tab namedCertificates
, copy the text in the box forSigning Certificate
. This is ourJWT_SECRET
.- Ensure that you add CRLF to the
JWT_SECRET
as we need this to be a string. Please Check the Instance below for reference only.
- Auth0 - Roles, Permissions and Scopes are sent to a user's accessToken (JWT).
- If you are using
auth0-spajs
orauth-reactjs
, JWT can be received with getTokenSilently. Snippet:const accessToken = await auth0Client.getTokenSilently();
- Decode the token on jwt.io. You will notice that a key that looks
AUTH_DIRECTIVES_ROLE_KEY
contains roles, permissions and scopes as a array. - In-Short, AUTH_DIRECTIVES_ROLE_KEY helps us to automatically tell
graphql
to use this key for roles.
Instance: Signing certificate may look like this.
-----BEGIN CERTIFICATE-----
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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