Why does OAuthV2 return a response without backend server, but GenerateJWT does not?
I am trying to use GenerateJWT and return the JWT Token. Ideally, I would like this too work in a similar fashion to OAuthV2, where the response is automatically generated.
Right now GenerateJWT just creates a variable with the JWT token, and it is up to me to find a way to return that as a response.
So what is the easiest way to return the JWT token. Ideally I don't want to have to spin up a NodeJs server, the only possible solution I have found so far.
Hi @Gary Sole ,
To return the JWT in a response (similar to what OAuthV2 does when you set GenerateResponse to "true"), you can use the Assign Message policy to return the JWT in a Header or in the Payload. You can do this in a "No Target" proxy. Place the AssignMessage after the JWT policy. Set AssignTo to "response". For example, to return the JWT in a header, you can do the following, where the JWT variable is the part of the <Header> element that's in curly braces:
<AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Message"> <Set> <Headers> <Header name="x-JWT">{jwt.JWT-Generate-HS256.generated_jwt}</Header> </Headers> </Set> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="response"/> </AssignMessage>
Here's a screenshot: jwt-no-target.png
Will
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |