How can I remove query parameters, like subscription keys, from an API request URL sent back to the user in APIM?

hampton123 1,175 Reputation points
2023-06-26T13:42:26.3933333+00:00

Is it possible to remove query parameters, like subscription keys, from the URL of an API request in APIM after it is processed? Specifically, I want users to be able to enter their subscription key through the URL of their request, but I don't want the key to be visible in the URL sent back to them after the request is processed. Is there a way to do this?

I've tried using the <set-query-parameter> policy in APIM, with no success.

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

Accepted answer
  1. Ben Gimblett 4,560 Reputation points Microsoft Employee
    2023-06-26T19:33:27.96+00:00

    REF comments above

    For reference in no particular order

    Google have a nice short and balanced doc on API key security here https://cloud.google.com/endpoints/docs/openapi/when-why-api-key(the concepts here are applicable to any architecture or cloud)

    There's a couple of simple [SPA] web app examples from MS that include B2C
    https://learn.microsoft.com/en-us/azure/active-directory-b2c/configure-authentication-sample-react-spa-app
    https://github.com/Azure-Samples/ms-identity-b2c-javascript-spa

    In both cases the app itself would be bootstrapped from a static web host/CDN (or static website on Storage) and the first thing the user would do is sign up or sign in. Thereafter API interaction is based on the access token derived from the login (id) token. An API key might be derived from the login (id) token claim or config

    For completeness

    This is a nice APIM companion doc to the older API OWASP list (we're working on an update as the OWASP top 10 has been updated) . https://learn.microsoft.com/en-us/azure/api-management/mitigate-owasp-api-threats

    This is a nice doc on auth and authz concepts in APIM https://learn.microsoft.com/en-us/azure/api-management/authentication-authorization-overview

    Hope this helps


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.