Keycloak integration with Hasura GraphQL – Unable to Authenticate using access token #10831
Replies: 2 comments
-
|
@Manjunath-Shivegowda-waisl Hasura GraphQL Engine definitely supports Keycloak. That error happened because you haven't configured the custom claims for the JWT yet. Check out this tutorial for more detail. |
Beta Was this translation helpful? Give feedback.
-
|
The error indicates that Hasura is not finding the expected JWT claims in your Keycloak token. You need to configure custom claims in Keycloak to match Hasura's expected format. In your Keycloak realm, create a mapper under your client configuration:
{
"x-hasura-default-role": "user",
"x-hasura-allowed-roles": ["user"],
"x-hasura-user-id": "{{sub}}"
}After creating the mapper, regenerate your access token and try again. The token should now include the required claims that Hasura expects for authentication. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi team,
We are trying to integrate Keycloak with Hasura GraphQL Engine, and wanted to confirm whether this integration is supported and if we are following the correct approach.
What we have done so far:
1.Created a user and role in Keycloak, along with username, password, and client secret.
2.Generated an access token using the following endpoint:
https://dev-aop-keycloak.wdplatform.com/realms/dev-aop/protocol/openid-connect/token
Error:
"errors": [
{
"message": "claims key: 'https://hasura.io/jwt/claims' not found",
"extensions": {
"path": "$",
"code": "jwt-invalid-claims"
}
}
]
Beta Was this translation helpful? Give feedback.
All reactions