Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TT-9790] How to parse custom JTW claims? #5420

Closed
amcowkin opened this issue Aug 15, 2023 · 2 comments
Closed

[TT-9790] How to parse custom JTW claims? #5420

amcowkin opened this issue Aug 15, 2023 · 2 comments

Comments

@amcowkin
Copy link

amcowkin commented Aug 15, 2023

I want to add new headers:
x-application-id
x-application-name
x-organisation-id
x-organisation-name

if I do like this "$tyk_context.jwt_claims_client_metadata.organisation_name" it does not work.

in the logs I see: “x-organisation-name-”

Question: how can I parse an array?

My jwt is:

{
  "pol": "MyAPI",
  "client_metadata": {
    "application_id": "1",
    "application_name": "SuperApp",
    "organisation_id": "1",
    "organisation_name": "SuperOrg"
  },
  "iss": "http://example.com/",
  "scope": "view create",
  "gty": "client-credentials"
}

But I can get pol: "$tyk_context.jwt_claims_pol"

the problem is in array

thank you

@Yubee116 Yubee116 changed the title How to parse custom JTW claims? [TT-9790] How to parse custom JTW claims? Aug 15, 2023
@andyo-tyk
Copy link
Contributor

Hi @amcowkin,
Tyk doesn't currently support nested fields in the JWT.
You should be able to get the result you expect if you remove the nesting, for example:

{
  "pol": "MyAPI",
   "application_id": "1",
   "application_name": "SuperApp",
   "organisation_id": "1",
   "organisation_name": "SuperOrg"
  "iss": "http://example.com/",
  "scope": "view create",
  "gty": "client-credentials"
} 

Does this work for you?

@amcowkin
Copy link
Author

Hi @andyo-tyk
thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants