I have a Kong api running with OIDC and request transform. Want sub ID. X-User-Id: {{jwt.claim.sub}}

So in he plugin i have added this: X-User-Id: {{jwt.claim.sub}} in the header and i hopet it fould add the user that sends the requests id. Because that is in the token. I have checked. But i just get the X-User-Id: {{jwt.claim.sub}} back after the token. So it looks like it dont dynamically change. What should i do?

Hi @Jensileus

You can send sub claim as a header from openid connect plugin using config upstream_headers_claims and upstream_headers_names

Thanks
-Veena

1 Like

Ok thank you, but the one i wrote or is that wrong? I have the id inside the sub, that i know. But do i need to add the same both on name and claims? And when i try to inject it with curl do i need there to add a header or will inject on the request either way? i have rs256 with openid for making it clear, the same in claim and in name at that is the X-User-Id: {{jwt.claim.sub}} ? And also, i have made a dummy-api for testing this, so i just print the auth.code on the flask-dummy-api when i send to it in curl do i need to add something?