How to rename 'subname' in access_token as 'client_id'

Hi folks,

I have a requirement to to have client_id value with key client_id and it should be present in access token and it does decoded by jwt.io. currently in JWT.io

“cts”: “OAUTH2_STATELESS_GRANT”,
“auditTrackingId”: “eecf6081-03*****************”,
“subname”: “6c1ad1a9*************”,
“iss”: “"
“tokenName”: “access_token”,
“token_type”: “Bearer”,
“authGrantId”: "-RHOe7pO
*”,
“aud”: “KONG”,
“nbf”: “978****”,
“grant_type”: “client_credentials”,
“scope”: [
“write”
],
“auth_time”: 1710256100,
“realm”: “/alpha”,
“exp”: 1710259700,
“iat”: 1710256100,
“expires_in”: 3600,
“jti”: “4NJmTe62C2louAO**********”,
}

In the access_token modification script how we can replace subname as client_id.
NOTE: IN aud we have used KONG as hard coded value as per the requirement we can’t revert back only we thought to have subname renamed as client_id so that the value will client_id

orginal
“subname”: “7873r89*************”
expected
“client_id”: “7873r89**************”

Thanks

hi @tanay.sinha11
You should use an Access Token script as explained here => Access token modification :: AM 7.4.0
To do what you want I think you should just add this in the script accessToken.setField('access_token', clientProperties.get("clientId"));
Cheers
Steph.

1 Like

Thankyou @stephane.orluc, it worked.

1 Like