Need details on how to receive a Bearer Token to call the Azure API Gateway Management APIs

RapidJames 1 Reputation point
2022-07-12T17:25:37.097+00:00

Can someone help me by providing me with an example CURL command to get a Bearer token to call the Azure API Gateway Management APIs? Similar to what gets created in the bottom-right of the following screenshot:220004-untitled-2.jpg

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

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 29,276 Reputation points
    2022-07-13T16:13:21.267+00:00

    @RapidJames Thanks for reaching out, The authorize url https://login.microsoftonline.com/common/oauth2/authorize will provide the refresh token and it gets redirect to token endpoint https://login.microsoftonline.com/{Tenant id}/oauth2/token to get the bearer token.

    please find the sample curl command below to fetch the bearer token to call the rest api's.

    provide the client id, client secret accordingly

    curl --location --request POST 'https://login.microsoftonline.com/{Tenant id}/oauth2/token' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --header 'Cookie: buid=0.ARoAv4j5cvGGr0GRqy180BHbR1m5UcQoBoBDr_2HE2393hMaAAA.AQABAAEAAAD--DLA3VO7QrddgJg7Wevrp1BuXyTtIceV0cVvUsX3XKuTcfl-2PAd2pPZJXdJlOldWOlRbQqBVQ2nfTsWC5otMhFCOl0508uw2C4J1aLfpJXxLjK6cWDKDrAy6fneInQgAA; esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr6LQosMsDuwEVGWro_cPd1IFZwgM08OlG_t20yFRLJGG4pQ_AcFDIFI18jv16nvtgMI0lQw4bec1ZB9Xa2Bz6D1O87BgZ5CjLA1RBj9wnIRtc5nRRmgWRvaWGhlVAwtfr71oB3VgDmpfBOEMROdYOpmfP1RTgVMdhUBqFOI2A3RIgAA; fpc=ArX3vpYIIelCocVLKfBRzbXzHjBSAwAAAFLdYNoOAAAA; stsservicecookie=estsfd; x-ms-gateway-slice=estsfd' \
    --data-urlencode 'client_id={clinetid}' \
    --data-urlencode 'resource=https://management.core.windows.net' \
    --data-urlencode 'client_secret={clientsecret}' \
    --data-urlencode 'grant_type=client_credentials'

    please let me know incase of further queries, I would be happy to assist you.

    To benefit the community find the right answers, please do mark the post which was helpful by clicking on Accept Answer’ & ‘Up-Vote’.


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.