Can any one assist me on below case?
how can I pass the bearer token authorization in main request? I applied custom extension policy in request processing stage and applied the external endpoint to get the access token. In response section I tried to add the authorization header with bearer token in main request header but i getting the 401(not authorized) https status.
Hi Zeeshan,
Are you trying to pass the authorization header with bearer token to the native service? You can add the header information as part of request processing in the request processing Custom Extension. Do let me know if it works.
Regards.
Hi @zeeshan.tufail,
I see you have two different variables in the transformation value in the response processing section. Where is the value for ${AccessToken} coming from? Can you try the below syntax for the Transformation value:
Bearer ${response[customExtension].payload.jsonPath[$.access_token]}
where “access_token” is the json attribute within custom extension’s response containing the access token that you would like to use.
Thanks guy. Issue has been resolved a week ago.
What was the resolution @zeeshan.tufail ?
I am also into the same situation where I am not able to access the custom variable storing access_token.
Thanks in advance !!
Hi @Shourabh_Kumar,
In the Response Processing->Transformation step of the Custom Extension, provide the variable name to which you want to assign the access_token value and variable value would be the json attribute from the response of the custom extension containing the access token. The syntax for both would be like below:
Variable name : ${request.headers.authorization} (This will pass the token value as an authorization header in the subsequent steps of your API)
Variable Value: Bearer ${response[customExtension].payload.jsonPath[$.access_token]}
where “access_token” is the json attribute within custom extension’s response containing the access token that you would like to use.
@Prabaa Can you help on how to pass the payload (client id and secret) if the oauth endpoint expects it as application/x-www-form-urlencoded ?
Thanks. It is working now after placing the payload as follows
client_id=value1&client_secret=value2
This topic was automatically closed after 1083 days. New replies are no longer allowed.