I have an API APP(say calculator) On which I enable AD Authentication using Portal. I added Calculator API into API management service. Now I want to get the OAuth token to call Calculator API. I read this post
In above post it mentioned that, get authorization code first & then get the token. I have made all the AAD applications & got the admin consent everything.
In APIM I wrote a policy to get the authorization code
<send-request mode="new" response-variable-name="responseObject" timeout="20" ignore-error="true">
<set-url>@("{{frontAuthServer}}?client_id={{clientId}}&response_type=code&redirect_uri={{FrontredirectUri}}&response_mode=query&resource={{scope}}")</set-url>
<set-method>GET</set-method>
</send-request>
<return-response response-variable-name="existing response variable">
<set-status code="200" reason="OK" />
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>
@(new JObject(new JProperty("code",((IResponse)context.Variables["code"]).Body.As<JObject>())).ToString())
</set-body>
</return-response>
But unfortunately authorization code is coming as a query parameter in response & I am not able to retrieve it using Policy. So I just want to know Is I am going into the right direction, If yes then how to retrieve Query parameter from response? OR which will be the correct way of doing this? I followed the same way mentioned here
but no luck. Is any settings needs to do ? Am I missing something?