JWT Token generation

how can i generate the JWT token based on the same client credentials provided for OAuth token generation

0 1 265
1 REPLY 1

<GenerateJWT name='generatejwt-1'>
  <Algorithm>HS256</Algorithm>
  <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
  <SecretKey>
    <Value ref='private.secretkey'/>
    <Id>cb24a396-4414-4793-b4ce-90333b694bff</Id>
  </SecretKey>
  <AdditionalClaims>
    <Claim name='additional-claim-name' ref='client_id'/>
  </AdditionalClaims>
  <OutputVariable>output_variable_name</OutputVariable>
</GenerateJWT>

Assuming you have a context variable called "client_id" then this will generate a JWT with a claim called "additional-claim-name" with the value of that client_id. People often want the sub claim to hold client id. In that case:

<GenerateJWT name='generatejwt-2'>
  <Algorithm>HS256</Algorithm>
  <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
  <SecretKey>
    <Value ref='private.secretkey'/>
    <Id>cb24a396-4414-4793-b4ce-90333b694bff</Id>
  </SecretKey>
  <Subject ref='client_id'/>
  <OutputVariable>output_variable_name</OutputVariable>
</GenerateJWT>