TODO: Migrations and metadata setup with hasura cli
Applications
menu option on the left and then click the + Create Application
button.Create Application
window, set a name for your application and select Single Page Web Applications
In the settings of the application, add http://localhost:8888/callback
as Allowed Callback URLs
and Allowed Web Origins
. Add domain specific URLs as well for production apps (e.g: https://mydomain.com/callback).
Open the Auth0 dashboard and then navigate to “Rules”. Then add a rule to add the custom JWT claims. You can name the rule anything you want.
**function** (user, context, callback) { **const** namespace = "<https://hasura.io/jwt/claims>"; context.idToken[namespace] = { 'x-hasura-default-role': 'user', *// do some custom logic to decide allowed roles*'x-hasura-allowed-roles': ['user'], 'x-hasura-user-id': user.user_id }; callback(**null**, user, context); }
You also need to create an API so that the access token issued by Auth0 is following the JWT standard. Read more about this here.
APIs
menu option on the left sidebar and then click the + Create API
button.New API
window, set a name for your API and enter hasura
Visit this url, select Auth0 as the provider and enter your domain.