graphql-engine
graphql-engine copied to clipboard
json array session variables in auth hook give parse error
Version Information
Server Version: v2.36.1 CLI Version (for CLI related issue):
Environment
OSS
What is the current behaviour?
in our system we use auth hook to authenticate and authorize users the auth hook give a response like so:
{
"X-Hasura-role":"user",
"X-Hasura-User-Id":"d6630142-d77c-4241-b5c3-ff28374114d0",
"X-Hasura-Allowed-Ids":[
"test1",
"test2"
]
}
which means user has access to test1 and test2 group
What is the expected behaviour?
when i do this hasura give this error "event":{"detail":"Invalid response from authorization hook: Error in $['X-Hasura-Allowed-Ids']: parsing Text failed, expected String, but encountered Array","type":"conn_err"},"user_vars":null}
if i switch from list to {"test1","test2"} notation it will solve the issue but it is not a supported type in any language. i see a merge request 2475 and 1799 which state it is fixed and merged but it is not working correctly for me. is there any solution?
@mostafashr Unfortunately, we don't support array session variables yet. The #1799 PR added support to accept {"test1", "test2"}
(String) as an array value. Please add a 👍🏽 to the issue if you'd like us to get this issue prioritized by our product team.
please consider many 3rd party auth libraries like clerk, etc, don't allow full customization to change JSON arrays into strings in JWT templates. For example {{ array | split(" ") }} does not work if it did, this wouldn't be an issue