1
votes

In the APIM's Developer portal, developers can get their own subscription key. Further developers can use API service by adding this subscription key to the header information of the http. However I didn't find a way to identify actual user by this subscription key. Therefore I want to know a way to identify user through subscription key.

Please help me to find an answer

1

1 Answers

1
votes

For example, if you want to set the user of the developer into the header of the request, you would add the following to the APIM policy:

<set-header name="user" exists-action="override">
    <value>@{var usr = context.User;
    return usr.Email;}</value>
</set-header>

So, you need to get it from the context.User. https://docs.microsoft.com/en-us/azure/api-management/api-management-policy-expressions#a-namepolicyexpressionsexamplesa-examples