You need to configure two clients in keycloak. One is for frontend(React, Angular, Svelte) and other for the Hasura engine.
You need to create new public client in keycloak
- Login to keycloak admin. Keycloak admin url http://KEYCLOAK_URL/auth/admin
- Go to client

- Click on
Create
Client IDAny unique client id you wantProtocolopenid-connectRoot URLRoot url of the application. Now we are using the http://localhost:4200
- Click on save

Now we will create backend for the hasura connector. It will require to verify the JWT token Obtained from the keycloak.
- Login to keycloak admin. Keycloak admin url http://KEYCLOAK_URL/auth/admin
- Go to client

- Click on
Create
- Click on save

- Select the
Access Typetobearer onlyand client onSave
- Copy the Secret from Credentials

X-Hasura-Group-Id Obtained by the group of the user. If user is added into group called as group1 then user organization id will be group1
, and for nested groups /group1/subgroup the X-Hasura-Group-Id is group1. To access the user group in token we need to add the scope for it so let get started
Following steps may vary for various keycloak version
-
Go to the Client scopes
-
Enter name
groups -
Goto mappers
-
Name:
groupsMapperType:Group MembershipToken claim namegroup
Congratulations! You have configured you keycloak for the hasura connector




