hasura-auth icon indicating copy to clipboard operation
hasura-auth copied to clipboard

Cannot use custom claim array values

Open azlekov opened this issue 2 years ago • 3 comments

First I have defined custom claim like this:

AUTH_JWT_CUSTOM_CLAIMS: '{"my-property-ids":"properties.id"}'

When user have properties, in the token I expect to have array with the IDs of these properties

I update table permissions like following:

image

Scenario 1: When there's no matching property IDs

{
  "errors": [
    {
      "extensions": {
        "code": "data-exception",
        "path": "$"
      },
      "message": "malformed array literal: \"null\""
    }
  ]
}

Scenario 2: When there's only one matching property ID

{
  "errors": [
    {
      "extensions": {
        "code": "data-exception",
        "path": "$"
      },
      "message": "malformed array literal: \"AuSoCKNydqpMqCGEixTdQ\""
    }
  ]
}

Scenario 3: When there's more then one matching property IDs

Everything looks to be working.

Is there something I'm doing wrong?

azlekov avatar Jul 31 '22 13:07 azlekov

You'd rather try

AUTH_JWT_CUSTOM_CLAIMS: '{"my-property-ids":"properties[].id"}'

See JSONata's official documentation

plmercereau avatar Sep 09 '22 17:09 plmercereau

JSONata's official documentation

@plmercereau nhost cloud permission variables does not allow the capture of square brackets []. how does one handle this ?

shiftlabs1 avatar Sep 19 '22 11:09 shiftlabs1

The Nhost cloud is being updated, it will be available soon. We also need to upgrade its hasura-auth version to 0.12

Reopening this issue until this is solved in the cloud

plmercereau avatar Sep 19 '22 11:09 plmercereau

Hasura-auth 0.13.2 is deployed in the cloud. Closing. Thanks for your patience

plmercereau avatar Sep 29 '22 10:09 plmercereau