support arrays in custom JWT claims
See original GitHub issueSupport for custom claims is great! But it chokes when we try to use an array –
code: “jwt-invalid-claims”
path: “$”
message: “x-hasura-* claims: expected Text, encountered Array”
Use case here is user “groups” (multiple). Not essential but including in the JWT would simplify our permission rules and save us some joins.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:16
- Comments:22 (9 by maintainers)
Top Results From Across the Web
Add a claim to JWT as an array? - Stack Overflow
I add claim as json array to claim for AuthorizedCompanies and parse it in client side.What is the design pattern here if any...
Read more >How to Validate Multiple Values of a Custom Claim in a JWT ...
1. If claims are in the format of arrays as below and want to validate that both values are present "groups": [ "group1",...
Read more >Help using JWT Policy In Apigee - custom claim as array
Solved: We got the JWT policy support in our orgs. When I am trying to assign an array to our custom claims, the...
Read more >Optional Custom Claim in jwt IDToken appearing as Array not ...
As this is defined as a string and configured as a string in the attribute, not an array, It should not come out...
Read more >Best Practices for Implementing Claims Succesfully | Curity
Once the custom claims issuing is complete, the main API endpoints will receive a useful JWT access token. On every request, the API...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Need this feature,
otherwise, for a multi-tenant app, you might need to write Hasura Action for every query/mutation out there…
Any update on this?
In the documentation:
You can find this is allowed for
x-hasura-allowed-roles
:So why we can not use it for the other claims?
Furthermore, the Postgres Array type is not a valid JSON format, one needs to manipulate JSON string to get it work. Not to mention, when work with AWS, which does not support JSON typed claims, so you have to pass a JSON string, and in that JSON string, we can only put a stringfied array there, like “{1,2,3}”, because otherwise,
JSON.stringfy
won’t even work., will this stringfied array still work?Not sure if this helps I use something like this with nodejs , it will only works for the strings tho
results in
the other solution would be to make proxy service that can convert arrays in claim to pg array format