Azure API Management - Get JWT from Ocp-Apim-Subscription-Key

Leonardo Ferreira 26 Reputation points
2021-08-26T17:01:32.193+00:00

When calling my API, the consumer uses a token on the "Ocp-Apim-Subscription-Key" that he got when he subscribed to my API. I was wondering how can I retrieve the details of this subscription (pref in a JWT token) and push it to the backend?

How can I relay a JWT to my backend with the information of the subscription provided via the token on the "Ocp-Apim-Subscription-Key" header?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,844 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,601 Reputation points Microsoft Employee
    2021-08-27T05:24:08.787+00:00

    @Leonardo Ferreira You can access subscription details via context.Subscription in your policy expressions. You could pass these details via custom headers to your backend using the set-header policy or in append them to the body using the set-body policy, whichever way works for you.

    You could leverage policy expressions to package the required data into a JWT Token as well.

    0 comments No comments