Protect API's using OAuth 2.0 in APIM

Published May 02 2021 06:20 AM 7,699 Views
Microsoft

The API Management is a proxy to the backend APIs, it’s a good practice to implement security mechanism to provide an extra layer of security to avoid unauthorized access to APIs.

 

 

Configuring OAuth 2.0 Server in APIM merely enables the Developer Portal’s test console as APIM’s client to acquire a token from Azure Active Directory. In the real world, customer will have a different client app that will need to be configured in AAD to get a valid OAuth token that APIM can validate.

 

 

Prerequisites

To follow the steps in this article, you must have:

  • Azure subscription
  • Azure API Management
  • An Azure AD tenant

API Management supports other mechanisms for securing access to APIs, including the following examples:

  • Subscription keys
    End-users who need to consume the APIs must include a valid subscription key in HTTP requests when they make calls to those APIs.
  • Client Certificate
    The second option is to use Client Certificates. In API Management you can configure to send the client certificates while making the API calls and validate incoming certificate and check certificate properties against desired values using policy expressions.
  • Restrict caller Ips
    The third option is Restrict caller Ips - It (allows/denies) calls from specific IP addresses and/or address ranges which is applied in the <ip-filter>Policy.

  • Securing the Back End API using OAuth2.0
    Another option is using OAuth 2.0, Users/services will acquire an access token from an authorization server via different grant methods and send the token in the authorization header. In the inbound policy the token can be validated.  

Azure AD OAUTH2.0 authorization in APIM

OAUTH 2.0 is the open standard for access delegation which provides client a secure delegated access to the resources on behalf of the resource owner.

 

SherrySahni_0-1619682546932.png

 

 

 

 

Note: In the real world, you will have a different client app that will need to be configured in AAD to get a valid OAuth token that APIM can validate. 

The below diagram depicts different client applications like Web application/SPA, Mobile App and a server process that may need to obtain a token in Non-Interactive mode. So you must create a different App Registration for the respective client application and use them to obtain the token.

 

 

 

SherrySahni_45-1619684106433.png

 

In this Diagram we can see the OAUTH flow with API Management in which:

  1. The Developer Portal requests a token from Azure AD using app registration client id and client secret.
  2. In the second step, the user is challenged to prove their identity by supplying User Credentials.
  3. After successful validation, Azure AD issues the access/refresh token.
  4. User makes an API call with the authorization header and the token gets validated by using validate-jwt policy in APIM by Azure AD.
  5. Based on the validation result, the user will receive the response in the developer portal.

Different OAuth Grant Types​:

Grant Flow

 

Description

 

Use Case

 

Authorization Code

 

It is the most used grant type to authorize the Client to access protected data from a Resource Server.

 

Used by the secure client like a web server.

 

Implicit

 

It is intended for user-based clients who can’t keep a client secret because all the application code and storage is easily accessible.

 

Used by the client that can’t protect a client secret/token, such as a mobile app or single page application.

 

Client Credentials

 

This grant type is non interactive way for obtaining an access token outside of the context of a user.

 

It is suitable for machine-to-machine authentication where a specific user’s permission to access data is not required.

 

Resource Owner password Credentials

 

It uses the username and the password credentials of a Resource Owner (user) to authorize and access protected data from a Resource Server.

 

For logging in with a username and password (only for first-party apps)

 

High-level steps required to configure OAUTH

To configure Oauth2 with APIM the following needs to be created:

  • Register an application (backend-app) in Azure AD to represent the protected API resource.​
  • Register another application (client-app) in Azure AD which represent a client that wants to access the protected API resource.​
  • In Azure AD, grant permissions to client(client-app) to access the protected resource (backend-app).​
  • Configure the Developer Console to call the API using OAuth 2.0 user authorization.​
  • Add the validate-jwt policy to validate the OAuth token for every incoming request.​​

Register an application (backend-app) in Azure AD to represent the API.​

To protect an API with Azure AD, first register an application in Azure AD that represents the API. The following steps use the Azure portal to register the application.

 

Search for Azure Active Directory and select App registrations under Azure Portal to register an application:

  1. Select New registration.
    SherrySahni_1-1619682546940.png

     

  2. In the Name section, enter a meaningful application name that will be displayed to users of the app.
  3. In the Supported account types section, select an option that suits your scenario.
  4. Leave the Redirect URI section empty.
  5. Select Register to create the application.
    SherrySahni_2-1619682546959.png
  6. On the app Overview page, find the Application (client) ID value and record it for later.

  SherrySahni_3-1619682546969.png

 

  1. Select Expose an API and set the Application ID URI with the default value. Record this value for later.
  2. Select the Add a scope button to display the Add a scope page. Then create a new scope that's supported by the API (for example, Files.Read).
  3. Select the Add scope button to create the scope. Repeat this step to add all scopes supported by your API.
  4. When the scopes are created, make a note of them for use in a subsequent step.
    SherrySahni_4-1619682546978.png

     

Register another application (client-app) in Azure AD to represent a client application that needs to call the API.​

Every client application that calls the API needs to be registered as an application in Azure AD. In this example, the client application is the Developer Console in the API Management developer portal.

To register another application in Azure AD to represent the Developer Console:

  1. Follow the steps 1 – 6. mentioned in the previous section for registering backend app.
  1. Once the App registered, On the app Overview page, find the Application (client) ID value and record it for later.
  2. Create a client secret for this application to use in a subsequent step.
    1. From the list of pages for your client app, select Certificates & secrets, and select New client secret.
    2. Under Add a client secret, provide a Description. Choose when the key should expire and select Add. When the secret is created, note the key value for use in a subsequent step.

SherrySahni_5-1619682546986.png

 

Authorization Code​:

 

In Authorization code grant type, User is challenged to prove their identity providing user credentials.
Upon successful authorization, the token end point is used to obtain an access token.

The obtained token is sent to the resource server and gets validated before sending the secured data to the client application.

SherrySahni_6-1619682546999.png

 

Enable OAuth 2.0 in the Developer Console for Authorization Code Grant type

At this point, we have created the applications in Azure AD, and granted proper permissions to allow the client-app to call the backend-app.

In this demo, the Developer Console is the client-app and has a walk through on how to enable OAuth 2.0 user authorization in the Developer Console.
Steps mentioned below:

  1. In Azure portal, browse to your API Management instance and Select OAuth 2.0 > Add.
  2. Provide a Display name and Description.
  3. For the Client registration page URL, enter a placeholder value, such as http://localhost.
  4. For Authorization grant types, select Authorization code.

    SherrySahni_7-1619682547010.png

     

  5. Specify the Authorization endpoint URL and Token endpoint URL. These values can be retrieved from the Endpoints page in your Azure AD tenant.

        Browse to the App registrations page again and select Endpoints.

SherrySahni_8-1619682547021.png

 

 

SherrySahni_9-1619682547028.png

 

 Important

  1. Use either v1 or v2 endpoints. However, depending on which version you choose, the below step will be different. We recommend using v2 endpoints.
  2. If you use v1 endpoints, add a body parameter named resource. For the value of this parameter, use Application ID of the back-end app.
  3. If you use v2 endpoints, use the scope you created for the backend-app in the Default scope field. Also, make sure to set the value for the accessTokenAcceptedVersion property to 2 in your application manifest in Azure AD Client APP and Backend app.
    SherrySahni_10-1619682547091.png

     

  4. Next, specify the client credentials. These are the credentials for the client-app.
  5. For Client ID, use the Application ID of the client-app.
    SherrySahni_11-1619682547097.png

     

  6. For Client secret, use the key you created for the client-app earlier.
  7. Immediately following the client secret is the redirect_urls
    SherrySahni_12-1619682547104.png

     

  8. Go back to your client-app registration in Azure Active Directory under Authentication.
  9. .paste the redirect_url under Redirect URI, and  check the issuer tokens then click on Configure button to save.
    SherrySahni_13-1619682547124.png

     

Now that you have configured an OAuth 2.0 authorization server, the Developer Console can obtain access tokens from Azure AD.

The next step is to enable OAuth 2.0 user authorization for your API. This enables the Developer Console to know that it needs to obtain an access token on behalf of the user, before making calls to your API.

  1. Go to APIs menu under the APIM
  2. Select the API you want to protect and Go to Settings.
  3. Under Security, choose OAuth 2.0, select the OAuth 2.0 server you configured earlier and select save.

 

SherrySahni_14-1619682547139.png

 

 

Calling the API from the Developer Portal:


Now that the OAuth 2.0 user authorization is enabled on your API, the Developer Console will obtain an access token on behalf of the user, before calling the API.

  1. Copy the developer portal url from the overview blade of apim
    SherrySahni_15-1619682547148.png

     

  2. Browse to any operation under the API in the developer portal and select Try it. This brings you to the Developer Console.
  3. Note a new item in the Authorization section, corresponding to the authorization server you just added.
    SherrySahni_16-1619682547161.png

     

  4. Select Authorization code from the authorization drop-down list, and you are prompted to sign in to the Azure AD tenant. If you are already signed in with the account, you might not be prompted.
    SherrySahni_17-1619682547169.png

     

  5. After successful sign-in, an Authorization header is added to the request, with an access token from Azure AD. The following is a sample token (Base64 encoded):
    SherrySahni_18-1619682547177.png

     

  6. Select Send to call the API successfully with 200 ok response.
    SherrySahni_19-1619682547184.png

     

Validate-jwt policy to pre-authorize requests with AD token:


Why JWT VALIDATE TOKEN?


At this point we can call the APIs with the obtained bearer token.

However, what if someone calls your API without a token or with an invalid token? For example, try to call the API without the Authorization header, the call will still go through.

This is because the API Management does not validate the access token, It simply passes the Authorization header to the back-end API.

To pre-Authorize requests, we can use <validate-jwt> Policy by validating the access tokens of each incoming request. If a request does not have a valid token, API Management blocks it.

We will now configure the Validate JWT policy to pre-authorize requests in API Management, by validating the access tokens of each incoming request. If a request does not have a valid token, API Management blocks it.

  1. Browser to the APIs from the left menu of APIM
  2. Click on “ALL APIS” and open the inbound policy to add the validate-jwt policy(It checks the audience claim in an access token and returns an error message if the token is not valid.) and save it.
    SherrySahni_20-1619682547199.png

     

  3. Go back to the developer portal and send the api with invalid token.
  4. You would observe the 401 unauthorized.
    SherrySahni_21-1619682547244.png

     

  5. Modify the token from authorization header to the valid token and send the api again to observe the 200-ok response.

Understanding <validate-jwt> Policy

SherrySahni_22-1619682547272.png

 

In this section, we will be focusing on understanding how <validate-jwt> policy works (the image in the right side is the decoded JWT Token)

  • The validate-jwt policy supports the validation of JWT tokens from the security viewpoint, It validates a JWT (JSON Web Token) passed via the HTTP Authorization header
    If the validation fails, a 401 code is returned.
  •  The policy requires an openid-config endpoint to be specified via an openid-config element. API Management expects to browse this endpoint when evaluating the policy as it has information which is used internally to validate the token.
    Please Note : OpenID config URL differs for the v1 and v2 endpoints.
  • The required-claims section contains a list of claims expected to be present on the token for it to be considered valid. The specified claim value in the policy must be present in the token for validation to succeed.

    The claim value should be the Application ID of the Registered Azure AD Backend-APP.

Reference Article : https://docs.microsoft.com/en-us/azure/api-management/api-management-access-restriction-policies#Val...


OAuth2 implicit grant flow:

SherrySahni_23-1619682547283.png

 

The following diagram shows what the entire implicit sign-in flow looks like.

As mentioned, Implicit grant type is more suitable for the single page applications. In this grant type, The user is requested to signin by providing the user credentials

Once the credentials are validated the token is returned directly from the authorization endpoint instead of the token endpoint.

The token are short lived, and a fresh token will be obtained through a hidden request as user is already signed in.

NOTE : To successfully request an ID token and/or an access token, the app registration in the Azure portal - App registrations page must have the corresponding implicit grant flow enabled, by selecting ID tokens and access tokens in the Implicit grant and hybrid flows section. 

Implicit Flow – DEMO

The configuration for the implicit grant flow is similar to the authorization code, we would just need to change the Authorization Grant Type to “Implict Flow” in the OAuth2.0 tab in APIM as shown below.

SherrySahni_24-1619682547292.png

 

After the OAuth 2.0 server configuration, The next step is to enable OAuth 2.0 user authorization for your API under APIs Blade :

SherrySahni_25-1619682547301.png

 


Now that the OAuth 2.0 user authorization is enabled on your API, we can test the API operation in the Developer Portal for the Authorization type : “Implict”.

Once after choosing the Authorization type as Implicit, you should be prompted to sign into the Azure AD tenant. After successful sign-in, an Authorization header is added to the request, with an access token from Azure AD and APIs should successfully return the 200-ok response:

SherrySahni_26-1619682547315.png

Client Credentials flow

SherrySahni_27-1619682547330.png

 

The entire client credentials flow looks like the following diagram.


In the client credentials flow, permissions are granted directly to the application itself by an administrator.

Token endpoint is used to obtain a token using client ID and Client secret, the resource server receives the server and validates it before sending to the client.

Client Credentials – Demo

  • In Client Credential flow, The OAuth2.0 configuration in APIM should have Authorization Grant Type as “Client Credentials”

SherrySahni_28-1619682547339.png

 

  • Specify the Authorization endpoint URL and Token endpoint URL with the tenant ID
    SherrySahni_29-1619682547355.png

     

  • The value passed for the scope parameter in this request should be (application ID URI) of the backend app, affixed with the .default suffix : ”API://<Backend-APP ID>/.default”

    SherrySahni_30-1619682547376.png

     



Now that you have configured an OAuth 2.0 authorization server, The next step is to enable OAuth 2.0 user authorization for your API.

SherrySahni_31-1619682547396.png

 

Now that the OAuth 2.0 user authorization is enabled on your API, we can test the API operation in the Developer Portal for the Authorization type : “Client Credentials”.

Once after choosing the Authorization type as Client Credentials in the Developer Portal,

  1.  The sign in would happen internally with client secret and client ID without the user credentials.
  2. After successful sign-in, an Authorization header is added to the request, with an access token from Azure AD.

SherrySahni_32-1619682547416.png

 

  1. Select Send to call the API successfully.

SherrySahni_33-1619682547459.png

 

Detailing about Client Credential Flow:
https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow

About .default scope : https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#the-defau...

 

Resource Owner Password Credentials

 

SherrySahni_34-1619682547469.png

 

 The Resource Owner Password Credential (ROPC) flow allows an application to sign in users by directly handling their password.

The ROPC flow is a single request: it sends the client identification and user's credentials to the Identity Provided, and then receives tokens in return.

The client must request the user's email address and password before doing so. Immediately after a successful request, the client should securely release the user's credentials from memory.

 

Resource Owner Password Credentials – Demo

 

Disclaimer: The new developer portal currently does not support the ROPC type and being worked upon by the Engineering team.

We will be covering the Demo in Legacy Developer Portal on ROPC as new portal does not support this type yet.

Please note that legacy portal is going to get expired in 2023.


The OAuth2.0 server configuration would be similar to the other grant types, we would need select the Authorization grant types as  Resource Owner Password :

SherrySahni_35-1619682547479.png

 

SherrySahni_36-1619682547492.png

 

You can also specify the Ad User Credentials in the Resource owner password credentials section:

 

SherrySahni_37-1619682547501.png

 

Please note that it’s not a recommended flow as it requires a very high degree of trust in the application and carries risks which are not present in other grant types.

Now that you have configured an OAuth 2.0 authorization server, the next step is to enable OAuth 2.0 user authorization for your API.

SherrySahni_38-1619682547516.png

 

Now that the OAuth 2.0 user authorization is enabled on your API, we will be browsing to the legacy developer portal and maneuver to the API operation

  • Select Resource Owner Password from the authorization drop-down list
  • You will get a popup to pass the credentials with the option to “use test user” if you check this option it will be allowing the portal to sign in the user by directly handling their password added during the Oauth2.0 configuration and generate the token after clicking on Authorize button :
    SherrySahni_39-1619682547518.png

     

  • Another option is to uncheck the “test user” and Add the username and password to generate the token for different AD User and hit the authorize button
    SherrySahni_40-1619682547536.png

     

  • The access token would be added using the credentials supplied:
    SherrySahni_41-1619682547560.png

     

  • Select Send to call the API successfully.

SherrySahni_42-1619682547575.png

 

Please note that the validate jwt policy should be configured for preauthorizing the request for Resource owner password credential flow also.

 

Things to remember

 

Common issues when OAuth2.0 is integrated with API Management: 

 

  • Problem faced while obtaining a token with Client Credential Grant Type:

       Error Snapshot:

SherrySahni_43-1619682547599.png

 

Solution:

This error indicated that scope api://b29e6a33-9xxxxxxxxx/Files.Read is invalid.

As client_credentials flow requires application permission to work, but you may be passing the scope as Files.Read which is a delegated permission(user permission) and hence it rejected the scope.

To make it work, we would need to use default application scope as  “api://backendappID/.default”

  

  •  Receiving “401 Unauthorized” response

     Solution:

    You may be observing 401 unauthorized response returned by validate-jwt policy, its is recommended to look at the aud claims in the passed token and validate-jwt policy.


You can decode the token at  https://jwt.io/ and reverify it with the validate-jwt policy used in inbound section:
For example:

The Audience in the decoded token payload should match to the claim section of the validate-jwt policy:

SherrySahni_44-1619682547610.png

 


<claim name="aud">

      <value>api://b293-9f6b-4165-xxxxxxxxxxx</value>

</claim>

 

  •  Validate-JWT policy fails with IDX10511: Signature validation failed:

When we go to test the API and provide a JWT token in the Authorization header the policy may fail with the following error:  

  IDX10511: Signature validation failed. Keys tried: 'Microsoft.IdentityModel.Tokens.X509SecurityKey , KeyId: CtTuhMJmD5M7DLdzD2v2x3QKSRY

 

Solution :
If you look at the metadata for the config url (https://login.microsoftonline.com/common/.well-known/openid-configuration)you will find a jwks_uri property inside the resulting json.

This uri will point to a set of certificates used to sign and validate the jwt's.  You may find that the keyId (in this sample "CtTuhMJmD5M7DLdzD2v2x3QKSRY") does exist there. 

 

Something like this:

 

{

"keys": [{

"kty": "RSA",

"use": "sig",

"kid": "CtTuhMJmD5M7DLdzD2v2x3QKSRY",

"x5t": "CtTuhMJmD5M7DLdzD2v2x3QKSRY",

"n": "18uZ3P3IgOySln……",

"e": "AQAB",

"x5c": ["MII….."]

 

So it seems that it should be able to validate the signature.

 

If you look at the decoded jwt you may see something like this:

 

{

"typ": "JWT",

"alg": "RS256",

"x5t": "CtTuhMJmD5M7DLdzD2v2x3QKSRY",

"kid": "CtTuhMJmD5M7DLdzD2v2x3QKSRY"

}

.{

"aud": "00000003-0000-0000-c000-000000000000",

"iss": "https://sts.windows.net/<tenantID>/",

"appid": "1950a258-227b-4e31-a9cf-717495945fc2",

"nonce": "da3d8159-f9f6-4fa8-bbf8-9a2cd108a261",

 

 

There's a nonce in play here.  

This requires extra checking that validate-jwt does not do.  Getting a token for the Graph api and Sharepoint may emit a nonce property.  A token used to make calls to the Azure management api, however, will not have the nonce property.

 

The 'nonce' is a mechanism, that allows the receiver to determine if the token was forwarded. The signature is over the transformed nonce and requires special processing, so if you try and validate it directly, the signature validation will fail.

 

The validate jwt policy is not meant to validate tokens targeted for the Graph api or Sharepoint.  The best thing to do here is either remove the validate jwt policy and let the backend service validate it or use a token targeted for a different audience.

 

  • Validate-JWT policy fails with IDX10205: Issuer validation failed

Here is an example configuration a user might have added to their policy:

 

<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized. Access token is missing or invalid.">

    <openid-config url="https://login.microsoftonline.com/72f988bf-86af-91ab-2d7cd011db47/.well-known/openid-configuration" />

    <required-claims>

       <claim name="Aud" match="any">

           <value>api://72f988bf-86af-91ab-2d7cd011db47</value>

       </claim>

    </required-claims>

</validate-jwt>

 

When a we go to test that API and provide a JWT token in the Authorization header the policy may fail with the following error:

 

IDX10205: Issuer validation failed. Issuer: 'https://login.microsoftonline.com/72f988bf-86af-91ab-2d7cd011db47/v2.0'. Did not match: validationParameters.ValidIssuer: '' or validationParameters.ValidIssuers: 'https://sts.windows.net/72f988bf-86af-91ab-2d7cd011db47/'.

  

Solution:

This error message gets thrown when the Issuer ("iss") claim in the JWT token does not match the trusted issuer in the policy configuration.

 

Azure Active Directory offers two versions of the token endpoint, to support two different implementations. AAD also exposes two different metadata documents to describe its endpoints.

The OpenID Config files contains details about the AAD tenant endpoints and links to its signing key that APIM will use to verify the signature of the token. Here are the details of those two endpoints and documents (for the MSFT AAD tenant):

                                            

Azure AD Token Endpoint V1: https://login.microsoftonline.com/<tenantID>/oauth2/token

Azure AD OpenID Config V1: https://login.microsoftonline.com/<tenantID>/.well-known/openid-configuration

 

Azure AD Token Endpoint V2: https://login.microsoftonline.com/<tenantID>/oauth2/v2.0/token

Azure AD OpenID Config V2: https://login.microsoftonline.com/<tenantID>/v2.0/.well-known/openid-configuration

 

Error Details:

 

The error usually occurs because the user is using a mix between V1 and V2. So they request a token from V1 endpoint but configured <openid-config> setting pointing to V2 endpoint,  or vice versa.

 

The Azure AD V1 endpoint uses an issuer value of https://sts.windows.net/{tenant-id-guid}/

The Azure AD V2 endpoint uses an issuer value of https://login.microsoftonline.com/{tenant-id-guid}/v2.0

 

 

To resolve this issue you just need to make sure the <validate-jwt> policy is loading up the matching openid-config file to match the token. The easiest way is to just toggle the open-id config url within the policy and then it will move beyond this part of the validation logic.

 

<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized. Access token is missing or invalid.">

    <openid-config url="https://login.microsoftonline.com/{tenant-id-guid}/.well-known/openid-configuration" />

 

  1. Find the <openid-config> setting in their policy
  2. Just switch out the openid-config url between the two formats, replace {tenant-id-guid} with the Azure AD Tenant ID which you can collect from the Azure AD Overview tab within the Azure Portal

 

             https://login.microsoftonline.com/{tenant-id-guid}/.well-known/openid-configuration

             --- or ----

             https://login.microsoftonline.com/{tenant-id-guid}/v2.0/.well-known/openid-configuration

 

2 Comments
Microsoft

Great material!

New Contributor

Thanks for the excellent Article. I got stucked in one cases for last three week can you please guide- 

I need to call this APIM from logic app with Bearer token .Do i need to generate the token first? If yes can you please tell me the process to call APIM from Azure Logic APP with bearer token

%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%20class%3D%22lia-list-style-type-square%22%3E%0A%3CLI%3E%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3CSTRONG%3EValidate-JWT%20policy%20fails%20with%20IDX10511%3A%20Signature%20validation%20failed%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSTRONG%3EWhen%20we%20go%20to%20test%20the%20API%20and%20provide%20a%20JWT%20token%20in%20the%20Authorization%20header%20the%20policy%20may%20fail%20with%20the%20following%20error%3A%20%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%20IDX10511%3A%20Signature%20validation%20failed%3C%2FSTRONG%3E.%20Keys%20tried%3A%20'Microsoft.IdentityModel.Tokens.X509SecurityKey%20%2C%20KeyId%3A%20CtTuhMJmD5M7DLdzD2v2x3QKSRY%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESolution%20%3A%3CBR%20%2F%3E%3C%2FSTRONG%3EIf%20you%20look%20at%20the%20metadata%20for%20the%20config%20url%20(%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2F.well-known%2Fopenid-configuration%3C%2FA%3E)you%20will%20find%20a%20jwks_uri%20property%20inside%20the%20resulting%20json.%3C%2FP%3E%0A%3CP%3EThis%20uri%20will%20point%20to%20a%20set%20of%20certificates%20used%20to%20sign%20and%20validate%20the%20jwt's.%26nbsp%3B%20You%20may%20find%20that%20the%20keyId%20(in%20this%20sample%20%22%3CSTRONG%3ECtTuhMJmD5M7DLdzD2v2x3QKSRY%3C%2FSTRONG%3E%22)%20does%20exist%20there.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESomething%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%7B%3C%2FP%3E%0A%3CP%3E%22keys%22%3A%20%5B%7B%3C%2FP%3E%0A%3CP%3E%22kty%22%3A%20%22RSA%22%2C%3C%2FP%3E%0A%3CP%3E%22use%22%3A%20%22sig%22%2C%3C%2FP%3E%0A%3CP%3E%22kid%22%3A%20%22%3CSTRONG%3ECtTuhMJmD5M7DLdzD2v2x3QKSRY%3C%2FSTRONG%3E%22%2C%3C%2FP%3E%0A%3CP%3E%22x5t%22%3A%20%22CtTuhMJmD5M7DLdzD2v2x3QKSRY%22%2C%3C%2FP%3E%0A%3CP%3E%22n%22%3A%20%2218uZ3P3IgOySln%E2%80%A6%E2%80%A6%22%2C%3C%2FP%3E%0A%3CP%3E%22e%22%3A%20%22AQAB%22%2C%3C%2FP%3E%0A%3CP%3E%22x5c%22%3A%20%5B%22MII%E2%80%A6..%22%5D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20it%20seems%20that%20it%20should%20be%20able%20to%20validate%20the%20signature.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20look%20at%20the%20decoded%20jwt%20you%20may%20see%20something%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%7B%3C%2FP%3E%0A%3CP%3E%22typ%22%3A%20%22JWT%22%2C%3C%2FP%3E%0A%3CP%3E%22alg%22%3A%20%22RS256%22%2C%3C%2FP%3E%0A%3CP%3E%22x5t%22%3A%20%22CtTuhMJmD5M7DLdzD2v2x3QKSRY%22%2C%3C%2FP%3E%0A%3CP%3E%22kid%22%3A%20%22CtTuhMJmD5M7DLdzD2v2x3QKSRY%22%3C%2FP%3E%0A%3CP%3E%7D%3C%2FP%3E%0A%3CP%3E.%7B%3C%2FP%3E%0A%3CP%3E%22aud%22%3A%20%2200000003-0000-0000-c000-000000000000%22%2C%3C%2FP%3E%0A%3CP%3E%22iss%22%3A%20%22%3CA%20href%3D%22https%3A%2F%2Fsts.windows.net%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsts.windows.net%2F%3CTENANTID%3E%2F%3C%2FTENANTID%3E%3C%2FA%3E%22%2C%3C%2FP%3E%0A%3CP%3E%22appid%22%3A%20%221950a258-227b-4e31-a9cf-717495945fc2%22%2C%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%22nonce%22%3A%20%22da3d8159-f9f6-4fa8-bbf8-9a2cd108a261%22%2C%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere's%20a%20nonce%20in%20play%20here.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20requires%20extra%20checking%20that%20validate-jwt%20does%20not%20do.%20%26nbsp%3BGetting%20a%20token%20for%20the%20Graph%20api%20and%20Sharepoint%20may%20emit%20a%20nonce%20property.%26nbsp%3B%20A%20token%20used%20to%20make%20calls%20to%20the%20Azure%20management%20api%2C%20however%2C%20will%20not%20have%20the%20nonce%20property.%3C%2FP%3E%0A%3CP%3EThe%20'nonce'%20is%20a%20mechanism%2C%20that%20allows%20the%20receiver%20to%20determine%20if%20the%20token%20was%20forwarded.%20The%20signature%20is%20over%20the%20transformed%20nonce%20and%20requires%20special%20processing%2C%20so%20if%20you%20try%20and%20validate%20it%20directly%2C%20the%20signature%20validation%20will%20fail.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20validate%20jwt%20policy%20is%20not%20meant%20to%20validate%20tokens%20targeted%20for%20the%20Graph%20api%20or%20Sharepoint.%26nbsp%3B%20The%20best%20thing%20to%20do%20here%20is%20either%20remove%20the%20validate%20jwt%20policy%20and%20let%20the%20backend%20service%20validate%20it%20or%20use%20a%20token%20targeted%20for%20a%20different%20audience.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%20class%3D%22lia-list-style-type-square%22%3E%0A%3CLI%3E%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSTRONG%3EValidate-JWT%20policy%20fails%20with%20IDX10205%3A%20Issuer%20validation%20failed%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EHere%20is%20an%20example%20configuration%20a%20user%20might%20have%20added%20to%20their%20policy%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CVALIDATE-JWT%20header-name%3D%22%26quot%3BAuthorization%26quot%3B%22%20failed-validation-httpcode%3D%22%26quot%3B401%26quot%3B%22%20failed-validation-error-message%3D%22%26quot%3BUnauthorized.%22%20access%3D%22%22%20token%3D%22%22%20is%3D%22%22%20missing%3D%22%22%20or%3D%22%22%20invalid.%3D%22%22%3E%3C%2FVALIDATE-JWT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3COPENID-CONFIG%20url%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%3C%2FA%3E%22%20%2F%26gt%3B%3C%2FOPENID-CONFIG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CREQUIRED-CLAIMS%3E%3C%2FREQUIRED-CLAIMS%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCLAIM%20name%3D%22%26quot%3BAud%26quot%3B%22%20match%3D%22%26quot%3Bany%26quot%3B%22%3E%3C%2FCLAIM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CVALUE%3Eapi%3A%2F%2F72f988bf-86af-91ab-2d7cd011db47%3C%2FVALUE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20a%20we%20go%20to%20test%20that%20API%20and%20provide%20a%20JWT%20token%20in%20the%20Authorization%20header%20the%20policy%20may%20fail%20with%20the%20following%20error%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EIDX10205%3C%2FSTRONG%3E%3A%20%3CSTRONG%3EIssuer%20validation%20failed.%20Issuer%3A%3C%2FSTRONG%3E%20'%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2Fv2.0%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2Fv2.0%3C%2FA%3E'.%20%3CSTRONG%3EDid%20not%20match%3A%20validationParameters.ValidIssuer%3A%20''%20or%20validationParameters.ValidIssuers%3A%3C%2FSTRONG%3E%20'%3CA%20href%3D%22https%3A%2F%2Fsts.windows.net%2F72f988bf-86af-91ab-2d7cd011db47%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsts.windows.net%2F72f988bf-86af-91ab-2d7cd011db47%2F%3C%2FA%3E'.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESolution%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThis%20error%20message%20gets%20thrown%20when%20the%20Issuer%20(%22iss%22)%20claim%20in%20the%20JWT%20token%20does%20not%20match%20the%20trusted%20issuer%20in%20the%20policy%20configuration.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20Active%20Directory%20offers%20two%20versions%20of%20the%20token%20endpoint%2C%20to%20support%20two%20different%20implementations.%20AAD%20also%20exposes%20two%20different%20metadata%20documents%20to%20describe%20its%20endpoints.%20The%20OpenID%20Config%20files%20contains%20details%20about%20the%20AAD%20tenant%20endpoints%20and%20links%20to%20its%20signing%20key%20that%20APIM%20will%20use%20to%20verify%20the%20signature%20of%20the%20token.%20Here%20are%20the%20details%20of%20those%20two%20endpoints%20and%20documents%20(for%20the%20MSFT%20AAD%20tenant)%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20AD%20Token%20Endpoint%20%3CSTRONG%3EV1%3C%2FSTRONG%3E%3A%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%253ctenantID%253e%2Foauth2%2Ftoken%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2Foauth2%2Ftoken%3C%2FTENANTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EAzure%20AD%20OpenID%20Config%20%3CSTRONG%3EV1%3C%2FSTRONG%3E%3A%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2F.well-known%2Fopenid-configuration%3C%2FTENANTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20AD%20Token%20Endpoint%20%3CSTRONG%3EV2%3C%2FSTRONG%3E%3A%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2Foauth2%2Fv2.0%2Ftoken%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2Foauth2%2Fv2.0%2Ftoken%3C%2FTENANTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EAzure%20AD%20OpenID%20Config%20%3CSTRONG%3EV2%3C%2FSTRONG%3E%3A%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2Fv2.0%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2Fv2.0%2F.well-known%2Fopenid-configuration%3C%2FTENANTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EError%20Details%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20error%20usually%20occurs%20because%20the%20user%20is%20using%20a%20mix%20between%20V1%20and%20V2.%20So%20they%20request%20a%20token%20from%20V1%20endpoint%20but%20configured%20%3COPENID-CONFIG%3E%20setting%20pointing%20to%20V2%20endpoint%2C%26nbsp%3B%20or%20vice%20versa.%3C%2FOPENID-CONFIG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20Azure%20AD%20%3CSTRONG%3EV1%20endpoint%3C%2FSTRONG%3E%20uses%20an%20issuer%20value%20of%20%3CA%20href%3D%22https%3A%2F%2Fsts.windows.net%2F%257btenant-id-guid%257d%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsts.windows.net%2F%7Btenant-id-guid%7D%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThe%20Azure%20AD%20%3CSTRONG%3EV2%20endpoint%3C%2FSTRONG%3E%20uses%20an%20issuer%20value%20of%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%257btenant-id-guid%257d%2Fv2.0%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant-id-guid%7D%2Fv2.0%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20resolve%20this%20issue%20you%20just%20need%20to%20make%20sure%20the%20%3CVALIDATE-JWT%3E%20policy%20is%20loading%20up%20the%20matching%20openid-config%20file%20to%20match%20the%20token.%20The%20easiest%20way%20is%20to%20just%20toggle%20the%20open-id%20config%20url%20within%20the%20policy%20and%20then%20it%20will%20move%20beyond%20this%20part%20of%20the%20validation%20logic.%3C%2FVALIDATE-JWT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CVALIDATE-JWT%20header-name%3D%22%26quot%3BAuthorization%26quot%3B%22%20failed-validation-httpcode%3D%22%26quot%3B401%26quot%3B%22%20failed-validation-error-message%3D%22%26quot%3BUnauthorized.%22%20access%3D%22%22%20token%3D%22%22%20is%3D%22%22%20missing%3D%22%22%20or%3D%22%22%20invalid.%3D%22%22%3E%3C%2FVALIDATE-JWT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3COPENID-CONFIG%20url%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant-id-guid%7D%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant-id-guid%7D%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant-id-guid%7D%2F.well-known%2Fopenid-configuration%3C%2FA%3E%22%20%2F%26gt%3B%3C%2FOPENID-CONFIG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EFind%20the%20%3COPENID-CONFIG%3E%20setting%20in%20their%20policy%3C%2FOPENID-CONFIG%3E%3C%2FLI%3E%0A%3CLI%3EJust%20switch%20out%20the%20openid-config%20url%20between%20the%20two%20formats%2C%20replace%20%7Btenant-id-guid%7D%20with%20the%20Azure%20AD%20Tenant%20ID%20which%20you%20can%20collect%20from%20the%20Azure%20AD%20Overview%20tab%20within%20the%20Azure%20Portal%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CEM%3E%7Btenant-id-guid%7D%3C%2FEM%3E%2F.well-known%2Fopenid-configuration%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20---%20or%20----%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%257btenant-id-guid%257d%2Fv2.0%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CEM%3E%7Btenant-id-guid%7D%3C%2FEM%3E%2Fv2.0%2F.well-known%2Fopenid-configuration%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%20class%3D%22lia-list-style-type-square%22%3E%0A%3CLI%3E%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3CSTRONG%3EValidate-JWT%20policy%20fails%20with%20IDX10511%3A%20Signature%20validation%20failed%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSTRONG%3EWhen%20we%20go%20to%20test%20the%20API%20and%20provide%20a%20JWT%20token%20in%20the%20Authorization%20header%20the%20policy%20may%20fail%20with%20the%20following%20error%3A%20%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%20IDX10511%3A%20Signature%20validation%20failed%3C%2FSTRONG%3E.%20Keys%20tried%3A%20'Microsoft.IdentityModel.Tokens.X509SecurityKey%20%2C%20KeyId%3A%20CtTuhMJmD5M7DLdzD2v2x3QKSRY%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESolution%20%3A%3CBR%20%2F%3E%3C%2FSTRONG%3EIf%20you%20look%20at%20the%20metadata%20for%20the%20config%20url%20(%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2F.well-known%2Fopenid-configuration%3C%2FA%3E)you%20will%20find%20a%20jwks_uri%20property%20inside%20the%20resulting%20json.%3C%2FP%3E%0A%3CP%3EThis%20uri%20will%20point%20to%20a%20set%20of%20certificates%20used%20to%20sign%20and%20validate%20the%20jwt's.%26nbsp%3B%20You%20may%20find%20that%20the%20keyId%20(in%20this%20sample%20%22%3CSTRONG%3ECtTuhMJmD5M7DLdzD2v2x3QKSRY%3C%2FSTRONG%3E%22)%20does%20exist%20there.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESomething%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%7B%3C%2FP%3E%0A%3CP%3E%22keys%22%3A%20%5B%7B%3C%2FP%3E%0A%3CP%3E%22kty%22%3A%20%22RSA%22%2C%3C%2FP%3E%0A%3CP%3E%22use%22%3A%20%22sig%22%2C%3C%2FP%3E%0A%3CP%3E%22kid%22%3A%20%22%3CSTRONG%3ECtTuhMJmD5M7DLdzD2v2x3QKSRY%3C%2FSTRONG%3E%22%2C%3C%2FP%3E%0A%3CP%3E%22x5t%22%3A%20%22CtTuhMJmD5M7DLdzD2v2x3QKSRY%22%2C%3C%2FP%3E%0A%3CP%3E%22n%22%3A%20%2218uZ3P3IgOySln%E2%80%A6%E2%80%A6%22%2C%3C%2FP%3E%0A%3CP%3E%22e%22%3A%20%22AQAB%22%2C%3C%2FP%3E%0A%3CP%3E%22x5c%22%3A%20%5B%22MII%E2%80%A6..%22%5D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20it%20seems%20that%20it%20should%20be%20able%20to%20validate%20the%20signature.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20look%20at%20the%20decoded%20jwt%20you%20may%20see%20something%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%7B%3C%2FP%3E%0A%3CP%3E%22typ%22%3A%20%22JWT%22%2C%3C%2FP%3E%0A%3CP%3E%22alg%22%3A%20%22RS256%22%2C%3C%2FP%3E%0A%3CP%3E%22x5t%22%3A%20%22CtTuhMJmD5M7DLdzD2v2x3QKSRY%22%2C%3C%2FP%3E%0A%3CP%3E%22kid%22%3A%20%22CtTuhMJmD5M7DLdzD2v2x3QKSRY%22%3C%2FP%3E%0A%3CP%3E%7D%3C%2FP%3E%0A%3CP%3E.%7B%3C%2FP%3E%0A%3CP%3E%22aud%22%3A%20%2200000003-0000-0000-c000-000000000000%22%2C%3C%2FP%3E%0A%3CP%3E%22iss%22%3A%20%22%3CA%20href%3D%22https%3A%2F%2Fsts.windows.net%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fsts.windows.net%2F%3CTENANTID%3E%2F%3C%2FTENANTID%3E%3C%2FA%3E%22%2C%3C%2FP%3E%0A%3CP%3E%22appid%22%3A%20%221950a258-227b-4e31-a9cf-717495945fc2%22%2C%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%22nonce%22%3A%20%22da3d8159-f9f6-4fa8-bbf8-9a2cd108a261%22%2C%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere's%20a%20nonce%20in%20play%20here.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20requires%20extra%20checking%20that%20validate-jwt%20does%20not%20do.%20%26nbsp%3BGetting%20a%20token%20for%20the%20Graph%20api%20and%20Sharepoint%20may%20emit%20a%20nonce%20property.%26nbsp%3B%20A%20token%20used%20to%20make%20calls%20to%20the%20Azure%20management%20api%2C%20however%2C%20will%20not%20have%20the%20nonce%20property.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20'nonce'%20is%20a%20mechanism%2C%20that%20allows%20the%20receiver%20to%20determine%20if%20the%20token%20was%20forwarded.%20The%20signature%20is%20over%20the%20transformed%20nonce%20and%20requires%20special%20processing%2C%20so%20if%20you%20try%20and%20validate%20it%20directly%2C%20the%20signature%20validation%20will%20fail.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20validate%20jwt%20policy%20is%20not%20meant%20to%20validate%20tokens%20targeted%20for%20the%20Graph%20api%20or%20Sharepoint.%26nbsp%3B%20The%20best%20thing%20to%20do%20here%20is%20either%20remove%20the%20validate%20jwt%20policy%20and%20let%20the%20backend%20service%20validate%20it%20or%20use%20a%20token%20targeted%20for%20a%20different%20audience.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%20class%3D%22lia-list-style-type-square%22%3E%0A%3CLI%3E%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSTRONG%3EValidate-JWT%20policy%20fails%20with%20IDX10205%3A%20Issuer%20validation%20failed%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EHere%20is%20an%20example%20configuration%20a%20user%20might%20have%20added%20to%20their%20policy%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CVALIDATE-JWT%20header-name%3D%22%26quot%3BAuthorization%26quot%3B%22%20failed-validation-httpcode%3D%22%26quot%3B401%26quot%3B%22%20failed-validation-error-message%3D%22%26quot%3BUnauthorized.%22%20access%3D%22%22%20token%3D%22%22%20is%3D%22%22%20missing%3D%22%22%20or%3D%22%22%20invalid.%3D%22%22%3E%3C%2FVALIDATE-JWT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3COPENID-CONFIG%20url%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%3C%2FA%3E%22%20%2F%26gt%3B%3C%2FOPENID-CONFIG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CREQUIRED-CLAIMS%3E%3C%2FREQUIRED-CLAIMS%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCLAIM%20name%3D%22%26quot%3BAud%26quot%3B%22%20match%3D%22%26quot%3Bany%26quot%3B%22%3E%3C%2FCLAIM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CVALUE%3Eapi%3A%2F%2F72f988bf-86af-91ab-2d7cd011db47%3C%2FVALUE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20a%20we%20go%20to%20test%20that%20API%20and%20provide%20a%20JWT%20token%20in%20the%20Authorization%20header%20the%20policy%20may%20fail%20with%20the%20following%20error%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EIDX10205%3C%2FSTRONG%3E%3A%20%3CSTRONG%3EIssuer%20validation%20failed.%20Issuer%3A%3C%2FSTRONG%3E%20'%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2Fv2.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2Fv2.0%3C%2FA%3E'.%20%3CSTRONG%3EDid%20not%20match%3A%20validationParameters.ValidIssuer%3A%20''%20or%20validationParameters.ValidIssuers%3A%3C%2FSTRONG%3E%20'%3CA%20href%3D%22https%3A%2F%2Fsts.windows.net%2F72f988bf-86af-91ab-2d7cd011db47%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fsts.windows.net%2F72f988bf-86af-91ab-2d7cd011db47%2F%3C%2FA%3E'.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESolution%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThis%20error%20message%20gets%20thrown%20when%20the%20Issuer%20(%22iss%22)%20claim%20in%20the%20JWT%20token%20does%20not%20match%20the%20trusted%20issuer%20in%20the%20policy%20configuration.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20Active%20Directory%20offers%20two%20versions%20of%20the%20token%20endpoint%2C%20to%20support%20two%20different%20implementations.%20AAD%20also%20exposes%20two%20different%20metadata%20documents%20to%20describe%20its%20endpoints.%3C%2FP%3E%0A%3CP%3EThe%20OpenID%20Config%20files%20contains%20details%20about%20the%20AAD%20tenant%20endpoints%20and%20links%20to%20its%20signing%20key%20that%20APIM%20will%20use%20to%20verify%20the%20signature%20of%20the%20token.%20Here%20are%20the%20details%20of%20those%20two%20endpoints%20and%20documents%20(for%20the%20MSFT%20AAD%20tenant)%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20AD%20Token%20Endpoint%20%3CSTRONG%3EV1%3C%2FSTRONG%3E%3A%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%253ctenantID%253e%2Foauth2%2Ftoken%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2Foauth2%2Ftoken%3C%2FTENANTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EAzure%20AD%20OpenID%20Config%20%3CSTRONG%3EV1%3C%2FSTRONG%3E%3A%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2F.well-known%2Fopenid-configuration%3C%2FTENANTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20AD%20Token%20Endpoint%20%3CSTRONG%3EV2%3C%2FSTRONG%3E%3A%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2Foauth2%2Fv2.0%2Ftoken%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2Foauth2%2Fv2.0%2Ftoken%3C%2FTENANTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EAzure%20AD%20OpenID%20Config%20%3CSTRONG%3EV2%3C%2FSTRONG%3E%3A%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2Fv2.0%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2Fv2.0%2F.well-known%2Fopenid-configuration%3C%2FTENANTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EError%20Details%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20error%20usually%20occurs%20because%20the%20user%20is%20using%20a%20mix%20between%20V1%20and%20V2.%20So%20they%20request%20a%20token%20from%20V1%20endpoint%20but%20configured%20%3COPENID-CONFIG%3E%20setting%20pointing%20to%20V2%20endpoint%2C%26nbsp%3B%20or%20vice%20versa.%3C%2FOPENID-CONFIG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20Azure%20AD%20%3CSTRONG%3EV1%20endpoint%3C%2FSTRONG%3E%20uses%20an%20issuer%20value%20of%20%3CA%20href%3D%22https%3A%2F%2Fsts.windows.net%2F%257btenant-id-guid%257d%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fsts.windows.net%2F%7Btenant-id-guid%7D%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThe%20Azure%20AD%20%3CSTRONG%3EV2%20endpoint%3C%2FSTRONG%3E%20uses%20an%20issuer%20value%20of%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%257btenant-id-guid%257d%2Fv2.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant-id-guid%7D%2Fv2.0%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20resolve%20this%20issue%20you%20just%20need%20to%20make%20sure%20the%20%3CVALIDATE-JWT%3E%20policy%20is%20loading%20up%20the%20matching%20openid-config%20file%20to%20match%20the%20token.%20The%20easiest%20way%20is%20to%20just%20toggle%20the%20open-id%20config%20url%20within%20the%20policy%20and%20then%20it%20will%20move%20beyond%20this%20part%20of%20the%20validation%20logic.%3C%2FVALIDATE-JWT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CVALIDATE-JWT%20header-name%3D%22%26quot%3BAuthorization%26quot%3B%22%20failed-validation-httpcode%3D%22%26quot%3B401%26quot%3B%22%20failed-validation-error-message%3D%22%26quot%3BUnauthorized.%22%20access%3D%22%22%20token%3D%22%22%20is%3D%22%22%20missing%3D%22%22%20or%3D%22%22%20invalid.%3D%22%22%3E%3C%2FVALIDATE-JWT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3COPENID-CONFIG%20url%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant-id-guid%7D%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant-id-guid%7D%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant-id-guid%7D%2F.well-known%2Fopenid-configuration%3C%2FA%3E%22%20%2F%26gt%3B%3C%2FOPENID-CONFIG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EFind%20the%20%3COPENID-CONFIG%3E%20setting%20in%20their%20policy%3C%2FOPENID-CONFIG%3E%3C%2FLI%3E%0A%3CLI%3EJust%20switch%20out%20the%20openid-config%20url%20between%20the%20two%20formats%2C%20replace%20%7Btenant-id-guid%7D%20with%20the%20Azure%20AD%20Tenant%20ID%20which%20you%20can%20collect%20from%20the%20Azure%20AD%20Overview%20tab%20within%20the%20Azure%20Portal%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CEM%3E%7Btenant-id-guid%7D%3C%2FEM%3E%2F.well-known%2Fopenid-configuration%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20---%20or%20----%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%257btenant-id-guid%257d%2Fv2.0%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CEM%3E%7Btenant-id-guid%7D%3C%2FEM%3E%2Fv2.0%2F.well-known%2Fopenid-configuration%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2309538%22%20slang%3D%22en-US%22%3EProtect%20API's%20using%20OAuth%202.0%20in%20APIM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2309538%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20API%26nbsp%3BManagement%20is%20a%20proxy%20to%20the%20backend%20APIs%2C%20it%E2%80%99s%20a%20good%20practice%20to%20implement%20security%20mechanism%20to%20provide%20an%20extra%20layer%20of%20security%20to%20avoid%20unauthorized%20access%20to%20APIs.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-css%22%3E%3CCODE%3EConfiguring%20OAuth%202.0%20Server%20in%20APIM%20merely%20enables%20the%20Developer%20Portal%E2%80%99s%20test%20console%20as%20APIM%E2%80%99s%20client%20to%20acquire%20a%20token%20from%20Azure%20Active%20Directory.%20In%20the%20real%20world%2C%20customer%20will%20have%20a%20different%20client%20app%20that%20will%20need%20to%20be%20configured%20in%20AAD%20to%20get%20a%20valid%20OAuth%20token%20that%20APIM%20can%20validate.%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-2027363155%22%20id%3D%22toc-hId-2027363155%22%20id%3D%22toc-hId-2027363155%22%20id%3D%22toc-hId-2027363155%22%20id%3D%22toc-hId-2027363155%22%20id%3D%22toc-hId-2027363155%22%20id%3D%22toc-hId-2027363155%22%3E%3CSTRONG%3EPrerequisites%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3ETo%20follow%20the%20steps%20in%20this%20article%2C%20you%20must%20have%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAzure%20subscription%3C%2FLI%3E%0A%3CLI%3EAzure%20API%20Management%3C%2FLI%3E%0A%3CLI%3EAn%20Azure%20AD%20tenant%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAPI%20Management%20supports%20other%20mechanisms%20for%20securing%20access%20to%20APIs%2C%20including%20the%20following%20examples%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3ESubscription%20keys%3C%2FSTRONG%3E%20%3CBR%20%2F%3EEnd-users%20who%20need%20to%20consume%20the%20APIs%20must%20include%20a%20valid%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fapi-management%2Fapi-management-subscriptions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Esubscription%20key%3C%2FA%3E%20in%20HTTP%20requests%20when%20they%20make%20calls%20to%20those%20APIs.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EClient%20Certificate%3CBR%20%2F%3E%3C%2FSTRONG%3EThe%20second%20option%20is%20to%20use%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fapi-management%2Fapi-management-howto-mutual-certificates-for-clients%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EClient%20Certificates%3C%2FA%3E.%20In%20API%20Management%20you%20can%20configure%20to%20send%20the%20client%20certificates%20while%20making%20the%20API%20calls%20and%20validate%20incoming%20certificate%20and%20check%20certificate%20properties%20against%20desired%20values%20using%20policy%20expressions.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3ERestrict%20caller%20Ips%3CBR%20%2F%3E%3C%2FSTRONG%3EThe%20third%20option%20is%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fapi-management%2Fapi-management-access-restriction-policies%23RestrictCallerIPs%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ERestrict%20caller%20Ips%3C%2FA%3E%20-%20It%20(allows%2Fdenies)%20calls%20from%20specific%26nbsp%3BIP%26nbsp%3Baddresses%20and%2For%20address%20ranges%20which%20is%20applied%20in%20the%20%3CIP-FILTER%3EPolicy.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FIP-FILTER%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ESecuring%26nbsp%3Bthe%20Back%20End%20API%20using%20OAuth2.0%3CBR%20%2F%3E%3C%2FSTRONG%3EAnother%20option%20is%20using%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fapi-management%2Fapi-management-howto-protect-backend-with-aad%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EOAuth%202.0%3C%2FA%3E%2C%20Users%2Fservices%20will%20acquire%20an%20access%20token%20from%20an%20authorization%20server%20via%20different%20grant%20methods%20and%20send%20the%20token%20in%20the%20authorization%20header.%20In%20the%20inbound%20policy%20the%20token%20can%20be%20validated.%3CSTRONG%20style%3D%22font-family%3A%20inherit%3B%22%3E%26nbsp%3B%3C%2FSTRONG%3E%3CSTRONG%20style%3D%22font-family%3A%20inherit%3B%22%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH3%20id%3D%22toc-hId-219908692%22%20id%3D%22toc-hId-219908692%22%20id%3D%22toc-hId-219908692%22%20id%3D%22toc-hId-219908692%22%20id%3D%22toc-hId-219908692%22%20id%3D%22toc-hId-219908692%22%20id%3D%22toc-hId-219908692%22%3E%3CSTRONG%3EAzure%20AD%20OAUTH2.0%20authorization%20in%20APIM%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3EOAUTH%202.0%20is%20the%20open%20standard%20for%20access%20delegation%20which%20provides%20client%20a%20secure%20delegated%20access%20to%20the%20resources%20on%20behalf%20of%20the%20resource%20owner.%3CSTRONG%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_0-1619682546932.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276627i72FB97B0F46884D2%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_0-1619682546932.png%22%20alt%3D%22SherrySahni_0-1619682546932.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3ENote%3A%20In%20the%20real%20world%2C%20you%20will%20have%20a%20different%20client%20app%20that%20will%20need%20to%20be%20configured%20in%20AAD%20to%20get%20a%20valid%20OAuth%20token%20that%20APIM%20can%20validate.%20%0A%0AThe%20below%20diagram%20depicts%20different%20client%20applications%20like%20Web%20application%2FSPA%2C%20Mobile%20App%20and%20a%20server%20process%20that%20may%20need%20to%20obtain%20a%20token%20in%20Non-Interactive%20mode.%20So%20you%20must%20create%20a%20different%20App%20Registration%20for%20the%20respective%20client%20application%20and%20use%20them%20to%20obtain%20the%20token.%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_45-1619684106433.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276683iC13FD16EF1BE4B12%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_45-1619684106433.png%22%20alt%3D%22SherrySahni_45-1619684106433.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20Diagram%20we%20can%20see%20the%20OAUTH%20flow%20with%20API%20Management%20in%20which%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EThe%20Developer%20Portal%20requests%20a%20token%20from%20Azure%20AD%20using%20app%20registration%20client%20id%20and%20client%20secret.%3C%2FLI%3E%0A%3CLI%3EIn%20the%20second%20step%2C%20the%20user%20is%20challenged%20to%20prove%20their%20identity%20by%20supplying%20User%20Credentials.%3C%2FLI%3E%0A%3CLI%3EAfter%20successful%20validation%2C%20Azure%20AD%20issues%20the%20access%2Frefresh%20token.%3C%2FLI%3E%0A%3CLI%3EUser%20makes%20an%20API%20call%20with%20the%20authorization%20header%20and%20the%20token%20gets%20validated%20by%20using%20validate-jwt%20policy%20in%20APIM%20by%20Azure%20AD.%3C%2FLI%3E%0A%3CLI%3EBased%20on%20the%20validation%20result%2C%20the%20user%20will%20receive%20the%20response%20in%20the%20developer%20portal.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId--1587545771%22%20id%3D%22toc-hId--1587545771%22%20id%3D%22toc-hId--1587545771%22%20id%3D%22toc-hId--1587545771%22%20id%3D%22toc-hId--1587545771%22%20id%3D%22toc-hId--1587545771%22%20id%3D%22toc-hId--1587545771%22%3E%3CSTRONG%3EDifferent%20OAuth%20Grant%20Types%20%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CTABLE%20width%3D%22586%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3E%3CSTRONG%3EGrant%20Flow%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3E%3CSTRONG%3EDescription%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3E%3CSTRONG%3EUse%20Case%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3E%3CSTRONG%3EAuthorization%20Code%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3EIt%20is%20the%20most%20used%20grant%20type%20to%20authorize%20the%20Client%26nbsp%3Bto%20access%20protected%20data%20from%20a%26nbsp%3BResource%20Server.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3EUsed%20by%20the%20secure%20client%20like%20a%20web%20server.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3E%3CSTRONG%3EImplicit%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3EIt%20is%20intended%20for%20user-based%20clients%20who%20can%E2%80%99t%20keep%20a%26nbsp%3Bclient%20secret%26nbsp%3Bbecause%20all%20the%20application%20code%20and%20storage%20is%20easily%20accessible.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3EUsed%20by%20the%20client%20that%20can%E2%80%99t%20protect%20a%20client%20secret%2Ftoken%2C%20such%20as%20a%20mobile%20app%20or%20single%20page%20application.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3E%3CSTRONG%3EClient%20Credentials%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3EThis%20grant%20type%20is%20non%20interactive%20way%20for%20obtaining%20an%20access%20token%20outside%20of%20the%20context%20of%20a%20user.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3EIt%20is%20suitable%20for%20machine-to-machine%20authentication%20where%20a%20specific%20user%E2%80%99s%20permission%20to%20access%20data%20is%20not%20required.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3E%3CSTRONG%3EResource%20Owner%20password%20Credentials%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3EIt%20uses%20the%26nbsp%3Busername%26nbsp%3Band%20the%26nbsp%3Bpassword%26nbsp%3Bcredentials%20of%20a%26nbsp%3BResource%20Owner%26nbsp%3B(user)%20to%20authorize%20and%20access%20protected%20data%20from%20a%26nbsp%3BResource%20Server.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22195%22%3E%3CP%3EFor%20logging%20in%20with%20a%26nbsp%3Busername%20and%20password%26nbsp%3B(only%20for%20first-party%20apps)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-899967062%22%20id%3D%22toc-hId-899967062%22%20id%3D%22toc-hId-899967062%22%20id%3D%22toc-hId-899967062%22%20id%3D%22toc-hId-899967062%22%20id%3D%22toc-hId-899967062%22%20id%3D%22toc-hId-899967062%22%3E%3CSTRONG%3EHigh-level%20steps%20required%20to%20configure%20OAUTH%3C%2FSTRONG%3E%3CSTRONG%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3ETo%20configure%20Oauth2%20with%20APIM%20the%20following%20needs%20to%20be%20created%3A%3C%2FH3%3E%0A%3CUL%3E%0A%3CLI%3ERegister%20an%20application%20(backend-app)%20in%20Azure%20AD%20to%20represent%20the%20protected%20API%20resource.%3C%2FLI%3E%0A%3CLI%3ERegister%20another%20application%20(client-app)%20in%20Azure%20AD%20which%20represent%20a%20client%20that%20wants%20to%20access%26nbsp%3Bthe%20protected%20API%20resource.%3C%2FLI%3E%0A%3CLI%3EIn%20Azure%20AD%2C%20grant%20permissions%20to%20client(client-app)%20to%20access%20the%20protected%20resource%20(backend-app).%3C%2FLI%3E%0A%3CLI%3EConfigure%20the%20Developer%20Console%20to%20call%20the%20API%20using%20OAuth%202.0%20user%20authorization.%3C%2FLI%3E%0A%3CLI%3EAdd%20the%26nbsp%3Bvalidate-jwt%26nbsp%3Bpolicy%20to%20validate%20the%20OAuth%20token%20for%20every%20incoming%20request.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH3%20id%3D%22toc-hId--907487401%22%20id%3D%22toc-hId--907487401%22%20id%3D%22toc-hId--907487401%22%20id%3D%22toc-hId--907487401%22%20id%3D%22toc-hId--907487401%22%20id%3D%22toc-hId--907487401%22%20id%3D%22toc-hId--907487401%22%3E%3CSTRONG%3ERegister%20an%20application%20(backend-app)%20in%20Azure%20AD%20to%20represent%20the%20API.%20%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3ETo%20protect%20an%20API%20with%20Azure%20AD%2C%20first%20register%20an%20application%20in%20Azure%20AD%20that%20represents%20the%20API.%20The%20following%20steps%20use%20the%20Azure%20portal%20to%20register%20the%20application.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESearch%20for%20Azure%20Active%20Directory%20and%20select%26nbsp%3BApp%20registrations%20under%20Azure%20Portal%20to%20register%20an%20application%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ESelect%26nbsp%3BNew%20registration.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_1-1619682546940.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276628i6DB6E9E5BDEFF921%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_1-1619682546940.png%22%20alt%3D%22SherrySahni_1-1619682546940.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3EIn%20the%26nbsp%3BName%26nbsp%3Bsection%2C%20enter%20a%20meaningful%20application%20name%20that%20will%20be%20displayed%20to%20users%20of%20the%20app.%3C%2FLI%3E%0A%3CLI%3EIn%20the%26nbsp%3BSupported%20account%20types%26nbsp%3Bsection%2C%20select%20an%20option%20that%20suits%20your%20scenario.%3C%2FLI%3E%0A%3CLI%3ELeave%20the%26nbsp%3BRedirect%20URI%26nbsp%3Bsection%20empty.%3C%2FLI%3E%0A%3CLI%3ESelect%26nbsp%3BRegister%26nbsp%3Bto%20create%20the%20application.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_2-1619682546959.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276629iED3F713056F358D1%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_2-1619682546959.png%22%20alt%3D%22SherrySahni_2-1619682546959.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EOn%20the%20app%26nbsp%3BOverview%26nbsp%3Bpage%2C%20find%20the%26nbsp%3BApplication%20(client)%20ID%26nbsp%3Bvalue%20and%20record%20it%20for%20later.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_3-1619682546969.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276631i91B03BACF0E21754%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_3-1619682546969.png%22%20alt%3D%22SherrySahni_3-1619682546969.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ESelect%26nbsp%3BExpose%20an%20API%26nbsp%3Band%20set%20the%26nbsp%3BApplication%20ID%20URI%26nbsp%3Bwith%20the%20default%20value.%20Record%20this%20value%20for%20later.%3C%2FLI%3E%0A%3CLI%3ESelect%20the%26nbsp%3BAdd%20a%20scope%26nbsp%3Bbutton%20to%20display%20the%26nbsp%3BAdd%20a%20scope%26nbsp%3Bpage.%20Then%20create%20a%20new%20scope%20that's%20supported%20by%20the%20API%20(for%20example%2C%26nbsp%3BFiles.Read).%3C%2FLI%3E%0A%3CLI%3ESelect%20the%26nbsp%3BAdd%20scope%26nbsp%3Bbutton%20to%20create%20the%20scope.%20Repeat%20this%20step%20to%20add%20all%20scopes%20supported%20by%20your%20API.%3C%2FLI%3E%0A%3CLI%3EWhen%20the%20scopes%20are%20created%2C%20make%20a%20note%20of%20them%20for%20use%20in%20a%20subsequent%20step.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_4-1619682546978.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276632iD8BA69F367BFAEBE%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_4-1619682546978.png%22%20alt%3D%22SherrySahni_4-1619682546978.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId-1580025432%22%20id%3D%22toc-hId-1580025432%22%20id%3D%22toc-hId-1580025432%22%20id%3D%22toc-hId-1580025432%22%20id%3D%22toc-hId-1580025432%22%20id%3D%22toc-hId-1580025432%22%20id%3D%22toc-hId-1580025432%22%3E%3CSTRONG%3ERegister%20another%20application%20(client-app)%20in%20Azure%20AD%20to%20represent%20a%20client%20application%20that%20needs%20to%20call%26nbsp%3Bthe%20API.%20%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3EEvery%20client%20application%20that%20calls%20the%20API%20needs%20to%20be%20registered%20as%20an%20application%20in%20Azure%20AD.%20In%20this%20example%2C%20the%20client%20application%20is%20the%26nbsp%3BDeveloper%20Console%26nbsp%3Bin%20the%20API%20Management%20developer%20portal.%3C%2FP%3E%0A%3CP%3ETo%20register%20another%20application%20in%20Azure%20AD%20to%20represent%20the%20Developer%20Console%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EFollow%20the%20steps%201%20%E2%80%93%206.%20mentioned%20in%20the%20previous%20section%26nbsp%3Bfor%20registering%20backend%20app.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3COL%3E%0A%3CLI%3EOnce%20the%20App%20registered%2C%20On%20the%20app%26nbsp%3BOverview%26nbsp%3Bpage%2C%20find%20the%26nbsp%3BApplication%20(client)%20ID%26nbsp%3Bvalue%20and%20record%20it%20for%20later.%3C%2FLI%3E%0A%3CLI%3ECreate%20a%20client%20secret%20for%20this%20application%20to%20use%20in%20a%20subsequent%20step.%3C%2FLI%3E%0A%3COL%3E%0A%3CLI%3EFrom%20the%20list%20of%20pages%20for%20your%20client%20app%2C%20select%26nbsp%3BCertificates%20%26amp%3B%20secrets%2C%20and%20select%26nbsp%3BNew%20client%20secret.%3C%2FLI%3E%0A%3CLI%3EUnder%26nbsp%3BAdd%20a%20client%20secret%2C%20provide%20a%26nbsp%3BDescription.%20Choose%20when%20the%20key%20should%20expire%20and%20select%26nbsp%3BAdd.%20When%20the%20secret%20is%20created%2C%20note%20the%20key%20value%20for%20use%20in%20a%20subsequent%20step.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_5-1619682546986.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276633iD1CED022AB0842D1%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_5-1619682546986.png%22%20alt%3D%22SherrySahni_5-1619682546986.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EAuthorization%20Code%20%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20Authorization%20code%20grant%20type%2C%20User%20is%20challenged%20to%20prove%20their%20identity%20providing%20user%20credentials.%3CBR%20%2F%3EUpon%20successful%20authorization%2C%20the%20token%20end%20point%20is%20used%20to%20obtain%20an%20access%20token.%3C%2FP%3E%0A%3CP%3EThe%20obtained%20token%20is%20sent%20to%20the%20resource%20server%20and%20gets%20validated%20before%20sending%20the%20secured%20data%20to%20the%20client%20application.%3CSTRONG%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_6-1619682546999.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276636iED517E2E76203395%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_6-1619682546999.png%22%20alt%3D%22SherrySahni_6-1619682546999.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--227429031%22%20id%3D%22toc-hId--227429031%22%20id%3D%22toc-hId--227429031%22%20id%3D%22toc-hId--227429031%22%20id%3D%22toc-hId--227429031%22%20id%3D%22toc-hId--227429031%22%20id%3D%22toc-hId--227429031%22%3E%3CSTRONG%3EEnable%20OAuth%202.0%20in%20the%20Developer%20Console%20for%20Authorization%20Code%20Grant%20type%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3EAt%20this%20point%2C%20we%20have%20created%20the%20applications%20in%20Azure%20AD%2C%20and%20granted%20proper%20permissions%20to%20allow%20the%20client-app%20to%20call%20the%20backend-app.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3EIn%20this%20demo%2C%20the%20Developer%20Console%20is%20the%20client-app%20and%20has%20a%20walk%20through%20on%20how%20to%20enable%20OAuth%202.0%20user%20authorization%20in%20the%20Developer%20Console.%3CBR%20%2F%3ESteps%20mentioned%20below%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EIn%20Azure%20portal%2C%20browse%20to%20your%20API%20Management%20instance%20and%20Select%26nbsp%3BOAuth%202.0%26nbsp%3B%26gt%3B%26nbsp%3BAdd.%3C%2FLI%3E%0A%3CLI%3EProvide%20a%26nbsp%3BDisplay%20name%26nbsp%3Band%26nbsp%3BDescription.%3C%2FLI%3E%0A%3CLI%3EFor%20the%26nbsp%3BClient%20registration%20page%20URL%2C%20enter%20a%20placeholder%20value%2C%20such%20as%26nbsp%3B%3CA%20href%3D%22http%3A%2F%2Flocalhost%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Flocalhost%3C%2FA%3E.%3C%2FLI%3E%0A%3CLI%3EFor%26nbsp%3BAuthorization%20grant%20types%2C%20select%26nbsp%3BAuthorization%20code.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_7-1619682547010.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276634iDCC165D11B15B408%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_7-1619682547010.png%22%20alt%3D%22SherrySahni_7-1619682547010.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3ESpecify%20the%26nbsp%3BAuthorization%20endpoint%20URL%26nbsp%3Band%26nbsp%3BToken%20endpoint%20URL.%20These%20values%20can%20be%20retrieved%20from%20the%26nbsp%3BEndpoints%26nbsp%3Bpage%20in%20your%20Azure%20AD%20tenant.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Browse%20to%20the%26nbsp%3BApp%20registrations%26nbsp%3Bpage%20again%20and%20select%26nbsp%3BEndpoints.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_8-1619682547021.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276635iD58B650CDF4EBF62%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_8-1619682547021.png%22%20alt%3D%22SherrySahni_8-1619682547021.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_9-1619682547028.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276637iDD232FC09F45D825%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_9-1619682547028.png%22%20alt%3D%22SherrySahni_9-1619682547028.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--2034883494%22%20id%3D%22toc-hId--2034883494%22%20id%3D%22toc-hId--2034883494%22%20id%3D%22toc-hId--2034883494%22%20id%3D%22toc-hId--2034883494%22%20id%3D%22toc-hId--2034883494%22%20id%3D%22toc-hId--2034883494%22%3E%26nbsp%3B%3CSTRONG%3EImportant%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3COL%3E%0A%3CLI%3EUse%20either%26nbsp%3Bv1%26nbsp%3Bor%26nbsp%3Bv2%26nbsp%3Bendpoints.%20However%2C%20depending%20on%20which%20version%20you%20choose%2C%20the%20below%20step%20will%20be%20different.%20We%20recommend%20using%20v2%20endpoints.%3C%2FLI%3E%0A%3CLI%3EIf%20you%20use%26nbsp%3Bv1%26nbsp%3Bendpoints%2C%20add%20a%20body%20parameter%20named%26nbsp%3Bresource.%20For%20the%20value%20of%20this%20parameter%2C%20use%26nbsp%3BApplication%20ID%26nbsp%3Bof%20the%20back-end%20app.%3C%2FLI%3E%0A%3CLI%3EIf%20you%20use%26nbsp%3Bv2%26nbsp%3Bendpoints%2C%20use%20the%20scope%20you%20created%20for%20the%20backend-app%20in%20the%26nbsp%3BDefault%20scope%26nbsp%3Bfield.%20Also%2C%20make%20sure%20to%20set%20the%20value%20for%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fdevelop%2Freference-app-manifest%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EaccessTokenAcceptedVersion%3C%2FA%3E%26nbsp%3Bproperty%20to%26nbsp%3B2%26nbsp%3Bin%20your%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fdevelop%2Freference-app-manifest%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eapplication%20manifest%3C%2FA%3E%20in%20Azure%20AD%20Client%20APP%20and%20Backend%20app.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_10-1619682547091.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276639iFE7F401D266678F0%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_10-1619682547091.png%22%20alt%3D%22SherrySahni_10-1619682547091.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3ENext%2C%20specify%20the%20client%20credentials.%20These%20are%20the%20credentials%20for%20the%20client-app.%3C%2FLI%3E%0A%3CLI%3EFor%26nbsp%3BClient%20ID%2C%20use%20the%26nbsp%3BApplication%20ID%26nbsp%3Bof%20the%20client-app.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_11-1619682547097.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276638i1A2F7B4DF10735B4%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_11-1619682547097.png%22%20alt%3D%22SherrySahni_11-1619682547097.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3EFor%26nbsp%3BClient%20secret%2C%20use%20the%20key%20you%20created%20for%20the%20client-app%20earlier.%3C%2FLI%3E%0A%3CLI%3EImmediately%20following%20the%20client%20secret%20is%20the%26nbsp%3Bredirect_urls%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_12-1619682547104.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276640i36AFB7F1FF094D6D%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_12-1619682547104.png%22%20alt%3D%22SherrySahni_12-1619682547104.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3EGo%20back%20to%20your%20client-app%20registration%20in%20Azure%20Active%20Directory%20under%20Authentication.%3C%2FLI%3E%0A%3CLI%3E.paste%20the%26nbsp%3Bredirect_url%26nbsp%3Bunder%26nbsp%3BRedirect%20URI%2C%20and%26nbsp%3B%20check%20the%20issuer%20tokens%20then%20click%20on%26nbsp%3BConfigure%26nbsp%3Bbutton%20to%20save.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_13-1619682547124.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276642iE0C44CA875DF000E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_13-1619682547124.png%22%20alt%3D%22SherrySahni_13-1619682547124.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3ENow%20that%20you%20have%20configured%20an%20OAuth%202.0%20authorization%20server%2C%20the%20Developer%20Console%20can%20obtain%20access%20tokens%20from%20Azure%20AD.%3C%2FP%3E%0A%3CP%3EThe%20next%20step%20is%20to%20enable%20OAuth%202.0%20user%20authorization%20for%20your%20API.%20This%20enables%20the%20Developer%20Console%20to%20know%20that%20it%20needs%20to%20obtain%20an%20access%20token%20on%20behalf%20of%20the%20user%2C%20before%20making%20calls%20to%20your%20API.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EGo%20to%26nbsp%3BAPIs%20menu%20under%20the%20APIM%3C%2FLI%3E%0A%3CLI%3ESelect%20the%20API%20you%20want%20to%20protect%20and%20Go%20to%26nbsp%3BSettings.%3C%2FLI%3E%0A%3CLI%3EUnder%26nbsp%3BSecurity%2C%20choose%26nbsp%3BOAuth%202.0%2C%20select%20the%20OAuth%202.0%20server%20you%20configured%20earlier%20and%20select%20save.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_14-1619682547139.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276641i81BB05EA13743764%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_14-1619682547139.png%22%20alt%3D%22SherrySahni_14-1619682547139.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-452629339%22%20id%3D%22toc-hId-452629339%22%20id%3D%22toc-hId-452629339%22%20id%3D%22toc-hId-452629339%22%20id%3D%22toc-hId-452629339%22%20id%3D%22toc-hId-452629339%22%20id%3D%22toc-hId-452629339%22%3E%3CSTRONG%3ECalling%20the%20API%20from%20the%20Developer%20Portal%3A%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%3CBR%20%2F%3ENow%20that%20the%20OAuth%202.0%20user%20authorization%20is%20enabled%20on%20your%20API%2C%20the%20Developer%20Console%20will%20obtain%20an%20access%20token%20on%20behalf%20of%20the%20user%2C%20before%20calling%20the%20API.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ECopy%20the%20developer%20portal%20url%20from%20the%20overview%20blade%20of%20apim%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_15-1619682547148.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276643i2B6EA0E25530CC33%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_15-1619682547148.png%22%20alt%3D%22SherrySahni_15-1619682547148.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3EBrowse%20to%20any%20operation%20under%20the%20API%20in%20the%20developer%20portal%20and%20select%26nbsp%3BTry%20it.%20This%20brings%20you%20to%20the%20Developer%20Console.%3C%2FLI%3E%0A%3CLI%3ENote%20a%20new%20item%20in%20the%26nbsp%3BAuthorization%26nbsp%3Bsection%2C%20corresponding%20to%20the%20authorization%20server%20you%20just%20added.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_16-1619682547161.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276644i74DBC98D434DEDA0%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_16-1619682547161.png%22%20alt%3D%22SherrySahni_16-1619682547161.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3ESelect%26nbsp%3BAuthorization%20code%26nbsp%3Bfrom%20the%20authorization%20drop-down%20list%2C%20and%20you%20are%20prompted%20to%20sign%20in%20to%20the%20Azure%20AD%20tenant.%20If%20you%20are%20already%20signed%20in%20with%20the%20account%2C%20you%20might%20not%20be%20prompted.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_17-1619682547169.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276645iB318A2D396AE31AE%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_17-1619682547169.png%22%20alt%3D%22SherrySahni_17-1619682547169.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3EAfter%20successful%20sign-in%2C%20an%26nbsp%3BAuthorization%26nbsp%3Bheader%20is%20added%20to%20the%20request%2C%20with%20an%20access%20token%20from%20Azure%20AD.%20The%20following%20is%20a%20sample%20token%20(Base64%20encoded)%3A%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_18-1619682547177.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276646i95CE20EA264D3FFA%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_18-1619682547177.png%22%20alt%3D%22SherrySahni_18-1619682547177.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3ESelect%26nbsp%3BSend%26nbsp%3Bto%20call%20the%20API%20successfully%20with%20200%20ok%20response.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_19-1619682547184.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276647iB0A423D6E45D39FC%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_19-1619682547184.png%22%20alt%3D%22SherrySahni_19-1619682547184.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId--1354825124%22%20id%3D%22toc-hId--1354825124%22%20id%3D%22toc-hId--1354825124%22%20id%3D%22toc-hId--1354825124%22%20id%3D%22toc-hId--1354825124%22%20id%3D%22toc-hId--1354825124%22%20id%3D%22toc-hId--1354825124%22%3E%3CSTRONG%3EValidate-jwt%20policy%20to%20pre-authorize%20requests%20with%20AD%20token%3A%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CH3%20id%3D%22toc-hId-437524230%22%20id%3D%22toc-hId-437524230%22%20id%3D%22toc-hId-437524230%22%20id%3D%22toc-hId-437524230%22%20id%3D%22toc-hId-437524230%22%20id%3D%22toc-hId-437524230%22%20id%3D%22toc-hId-437524230%22%3E%3CSTRONG%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3CSTRONG%3EWhy%20JWT%20VALIDATE%20TOKEN%3F%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%3CBR%20%2F%3EAt%20this%20point%20we%20can%20call%20the%20APIs%20with%20the%20obtained%20bearer%20token.%3C%2FP%3E%0A%3CP%3EHowever%2C%20what%20if%20someone%20calls%20your%20API%20without%20a%20token%20or%20with%20an%20invalid%20token%3F%20For%20example%2C%20try%20to%20call%20the%20API%20without%20the%26nbsp%3BAuthorization%26nbsp%3Bheader%2C%20the%20call%20will%20still%20go%20through.%3C%2FP%3E%0A%3CP%3EThis%20is%20because%20the%20API%20Management%20does%20not%20validate%20the%20access%20token%2C%20It%20simply%20passes%20the%26nbsp%3BAuthorization%26nbsp%3Bheader%20to%20the%20back-end%20API.%3C%2FP%3E%0A%3CP%3ETo%20pre-Authorize%20requests%2C%20we%20can%20use%20%3CVALIDATE-JWT%3E%20Policy%20by%20validating%20the%20access%20tokens%20of%20each%20incoming%20request.%20If%20a%20request%20does%20not%20have%20a%20valid%20token%2C%20API%20Management%20blocks%20it.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CEM%3EWe%20will%20now%20configure%20the%26nbsp%3B%3C%2FEM%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fapi-management%2Fapi-management-access-restriction-policies%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CEM%3EValidate%20JWT%3C%2FEM%3E%3C%2FA%3E%3CEM%3E%26nbsp%3Bpolicy%20to%20pre-authorize%20requests%20in%20API%20Management%2C%20by%20validating%20the%20access%20tokens%20of%20each%20incoming%20request.%20If%20a%20request%20does%20not%20have%20a%20valid%20token%2C%20API%20Management%20blocks%20it.%3C%2FEM%3E%3C%2FVALIDATE-JWT%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EBrowser%20to%20the%20APIs%20from%20the%20left%20menu%20of%20APIM%3C%2FLI%3E%0A%3CLI%3EClick%20on%20%E2%80%9CALL%20APIS%E2%80%9D%20and%20open%20the%20inbound%20policy%20to%20add%20the%20validate-jwt%20policy(It%20checks%20the%20audience%20claim%20in%20an%20access%20token%20and%20returns%20an%20error%20message%20if%20the%20token%20is%20not%20valid.)%20and%20save%20it.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_20-1619682547199.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276648iEC41904766E90828%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_20-1619682547199.png%22%20alt%3D%22SherrySahni_20-1619682547199.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3EGo%20back%20to%20the%20developer%20portal%20and%20send%20the%20api%20with%20invalid%20token.%3C%2FLI%3E%0A%3CLI%3EYou%20would%20observe%20the%20401%20unauthorized.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_21-1619682547244.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276650i9E3E6BBC0D63FA1D%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_21-1619682547244.png%22%20alt%3D%22SherrySahni_21-1619682547244.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3EModify%20the%20token%20from%20authorization%20header%20to%20the%20valid%20token%20and%20send%20the%20api%20again%20to%20observe%20the%20200-ok%20response.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId--1369930233%22%20id%3D%22toc-hId--1369930233%22%20id%3D%22toc-hId--1369930233%22%20id%3D%22toc-hId--1369930233%22%20id%3D%22toc-hId--1369930233%22%20id%3D%22toc-hId--1369930233%22%20id%3D%22toc-hId--1369930233%22%3E%3CSTRONG%3EUnderstanding%20%3CVALIDATE-JWT%3E%20Policy%3C%2FVALIDATE-JWT%3E%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_22-1619682547272.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276651iDF7DEC721C7C94A2%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_22-1619682547272.png%22%20alt%3D%22SherrySahni_22-1619682547272.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20section%2C%20we%20will%20be%20focusing%20on%20understanding%20how%20%3CVALIDATE-JWT%3E%20policy%20works%20(the%20image%20in%20the%20right%20side%20is%20the%20decoded%20JWT%20Token)%3C%2FVALIDATE-JWT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThe%20validate-jwt%20policy%20supports%20the%20validation%20of%20JWT%20tokens%20from%20the%20security%20viewpoint%2C%20It%20validates%20a%20JWT%20(JSON%20Web%20Token)%20passed%20via%20the%20HTTP%26nbsp%3BAuthorization%26nbsp%3Bheader%3CBR%20%2F%3EIf%20the%20validation%20fails%2C%20a%20401%20code%20is%20returned.%3C%2FLI%3E%0A%3CLI%3E%26nbsp%3BThe%20policy%20requires%20an%26nbsp%3Bopenid-config%20endpoint%20to%20be%20specified%20via%20an%20openid-config%20element.%20API%20Management%20expects%20to%20browse%20this%20endpoint%20when%20evaluating%20the%20policy%20as%20it%20has%20information%20which%20is%20used%20internally%20to%20validate%20the%20token.%20%3CBR%20%2F%3EPlease%20Note%20%3A%20OpenID%20config%20URL%20differs%20for%20the%20v1%20and%20v2%20endpoints.%3C%2FLI%3E%0A%3CLI%3EThe%26nbsp%3Brequired-claims%26nbsp%3Bsection%20contains%20a%20list%20of%20claims%20expected%20to%20be%20present%20on%20the%20token%20for%20it%20to%20be%20considered%20valid.%20The%20specified%20claim%20value%20in%20the%20policy%20must%20be%20present%20in%20the%20token%20for%20validation%20to%20succeed.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20The%20claim%20value%20should%20be%20the%20Application%20ID%20of%20the%20Registered%20Azure%20AD%20Backend-APP.%3CBR%20%2F%3E%3CBR%20%2F%3EReference%20Article%20%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fapi-management%2Fapi-management-access-restriction-policies%23ValidateJWT%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fapi-management%2Fapi-management-access-restriction-policies%23ValidateJWT%3C%2FA%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1117582600%22%20id%3D%22toc-hId-1117582600%22%20id%3D%22toc-hId-1117582600%22%20id%3D%22toc-hId-1117582600%22%20id%3D%22toc-hId-1117582600%22%20id%3D%22toc-hId-1117582600%22%20id%3D%22toc-hId-1117582600%22%3E%3CBR%20%2F%3E%3CSTRONG%3EOAuth2%20implicit%20grant%20flow%3A%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_23-1619682547283.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276649i9C2EECF508CB7540%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_23-1619682547283.png%22%20alt%3D%22SherrySahni_23-1619682547283.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20following%20diagram%20shows%20what%20the%20entire%20implicit%20sign-in%20flow%20looks%20like.%3CBR%20%2F%3E%3CBR%20%2F%3EAs%20mentioned%2C%20Implicit%20grant%20type%20is%20more%20suitable%20for%20the%20single%20page%20applications.%20In%20this%20grant%20type%2C%20The%20user%20is%20requested%20to%20signin%20by%20providing%20the%20user%20credentials%3C%2FP%3E%0A%3CP%3EOnce%20the%20credentials%20are%20validated%20the%20token%20is%20returned%20directly%20from%20the%20authorization%20endpoint%20instead%20of%20the%20token%20endpoint.%3C%2FP%3E%0A%3CP%3EThe%20token%20are%20short%20lived%2C%20and%20a%20fresh%20token%20will%20be%20obtained%20through%20a%20hidden%20request%20as%20user%20is%20already%20signed%20in.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENOTE%3C%2FSTRONG%3E%20%3A%20To%20successfully%20request%20an%20ID%20token%20and%2For%20an%20access%20token%2C%20the%20app%20registration%20in%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3Flinkid%3D2083908%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20portal%20-%20App%20registrations%3C%2FA%3E%26nbsp%3Bpage%20must%20have%20the%20corresponding%20implicit%20grant%20flow%20enabled%2C%20by%20selecting%26nbsp%3BID%20tokens%26nbsp%3Band%26nbsp%3Baccess%20tokens%26nbsp%3Bin%20the%26nbsp%3BImplicit%20grant%20and%20hybrid%20flows%26nbsp%3Bsection.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--689871863%22%20id%3D%22toc-hId--689871863%22%20id%3D%22toc-hId--689871863%22%20id%3D%22toc-hId--689871863%22%20id%3D%22toc-hId--689871863%22%20id%3D%22toc-hId--689871863%22%20id%3D%22toc-hId--689871863%22%3E%3CSTRONG%3EImplicit%20Flow%20%E2%80%93%20DEMO%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3EThe%20configuration%20for%20the%20implicit%20grant%20flow%20is%20similar%20to%20the%20authorization%20code%2C%20we%20would%20just%20need%20to%20change%20the%20Authorization%20Grant%20Type%20to%20%E2%80%9CImplict%20Flow%E2%80%9D%20in%20the%20OAuth2.0%20tab%20in%20APIM%20as%20shown%20below.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_24-1619682547292.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276654iABDE5AEE68FB9B50%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_24-1619682547292.png%22%20alt%3D%22SherrySahni_24-1619682547292.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAfter%20the%20OAuth%202.0%20server%20configuration%2C%20The%20next%20step%20is%20to%20enable%20OAuth%202.0%20user%20authorization%20for%20your%20API%20under%20APIs%20Blade%20%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_25-1619682547301.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276653i495C4ACAEEDF9F8E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_25-1619682547301.png%22%20alt%3D%22SherrySahni_25-1619682547301.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ENow%20that%20the%20OAuth%202.0%20user%20authorization%20is%20enabled%20on%20your%20API%2C%20we%20can%20test%20the%20API%20operation%20in%20the%20Developer%20Portal%20for%20the%20Authorization%20type%20%3A%20%E2%80%9CImplict%E2%80%9D.%3C%2FP%3E%0A%3CP%3EOnce%20after%20choosing%20the%20Authorization%20type%20as%20Implicit%2C%20you%20should%20be%20prompted%20to%20sign%20into%20the%20Azure%20AD%20tenant.%20After%20successful%20sign-in%2C%20an%26nbsp%3BAuthorization%26nbsp%3Bheader%20is%20added%20to%20the%20request%2C%20with%20an%20access%20token%20from%20Azure%20AD%20and%20APIs%20should%20successfully%20return%20the%20200-ok%20response%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_26-1619682547315.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276655iF9E9C6212D80FF39%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_26-1619682547315.png%22%20alt%3D%22SherrySahni_26-1619682547315.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1797640970%22%20id%3D%22toc-hId-1797640970%22%20id%3D%22toc-hId-1797640970%22%20id%3D%22toc-hId-1797640970%22%20id%3D%22toc-hId-1797640970%22%20id%3D%22toc-hId-1797640970%22%20id%3D%22toc-hId-1797640970%22%3E%3CSTRONG%3EClient%20Credentials%20flow%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_27-1619682547330.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276657iE2892E37AFC52F4F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_27-1619682547330.png%22%20alt%3D%22SherrySahni_27-1619682547330.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20entire%20client%20credentials%20flow%20looks%20like%20the%20following%20diagram.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EIn%20the%20client%20credentials%20flow%2C%20permissions%20are%20granted%20directly%20to%20the%20application%20itself%20by%20an%20administrator.%3C%2FP%3E%0A%3CP%3EToken%20endpoint%20is%20used%20to%20obtain%20a%20token%20using%20client%20ID%20and%20Client%20secret%2C%20the%20resource%20server%20receives%20the%20server%20and%20validates%20it%20before%20sending%20to%20the%20client.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--9813493%22%20id%3D%22toc-hId--9813493%22%20id%3D%22toc-hId--9813493%22%20id%3D%22toc-hId--9813493%22%20id%3D%22toc-hId--9813493%22%20id%3D%22toc-hId--9813493%22%20id%3D%22toc-hId--9813493%22%3E%3CSTRONG%3EClient%20Credentials%20%E2%80%93%20Demo%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CUL%3E%0A%3CLI%3EIn%20Client%20Credential%20flow%2C%20The%20OAuth2.0%20configuration%20in%20APIM%20should%20have%20Authorization%20Grant%20Type%20as%20%E2%80%9CClient%20Credentials%E2%80%9D%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_28-1619682547339.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276656i9227E7E106EDBF4B%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_28-1619682547339.png%22%20alt%3D%22SherrySahni_28-1619682547339.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ESpecify%20the%26nbsp%3BAuthorization%20endpoint%20URL%26nbsp%3Band%26nbsp%3BToken%20endpoint%20URL%20with%20the%20tenant%20ID%20%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_29-1619682547355.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276658i4A75DD14CC73E68D%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_29-1619682547355.png%22%20alt%3D%22SherrySahni_29-1619682547355.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3EThe%20value%20passed%20for%20the%26nbsp%3Bscope%26nbsp%3Bparameter%20in%20this%20request%20should%20be%20(application%20ID%20URI)%20of%20the%20backend%20app%2C%20affixed%20with%20the%26nbsp%3B.default%26nbsp%3Bsuffix%20%3A%20%E2%80%9DAPI%3A%2F%2F%3CBACKEND-APP%20id%3D%22%22%3E%2F.default%E2%80%9D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_30-1619682547376.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276661i0F09172923A08D02%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_30-1619682547376.png%22%20alt%3D%22SherrySahni_30-1619682547376.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FBACKEND-APP%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ENow%20that%20you%20have%20configured%20an%20OAuth%202.0%20authorization%20server%2C%20The%20next%20step%20is%20to%20enable%20OAuth%202.0%20user%20authorization%20for%20your%20API.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_31-1619682547396.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276659i0D397C91A05F6401%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_31-1619682547396.png%22%20alt%3D%22SherrySahni_31-1619682547396.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20that%20the%20OAuth%202.0%20user%20authorization%20is%20enabled%20on%20your%20API%2C%20we%20can%20test%20the%20API%20operation%20in%20the%20Developer%20Portal%20for%20the%20Authorization%20type%20%3A%20%E2%80%9CClient%20Credentials%E2%80%9D.%3C%2FP%3E%0A%3CP%3EOnce%20after%20choosing%20the%20Authorization%20type%20as%20Client%20Credentials%20in%20the%20Developer%20Portal%2C%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%26nbsp%3BThe%20sign%20in%20would%20happen%20internally%20with%20client%20secret%20and%20client%20ID%20without%20the%20user%20credentials.%3C%2FLI%3E%0A%3CLI%3EAfter%20successful%20sign-in%2C%20an%26nbsp%3BAuthorization%26nbsp%3Bheader%20is%20added%20to%20the%20request%2C%20with%20an%20access%20token%20from%20Azure%20AD.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_32-1619682547416.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276660i8B373666CEE0326E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_32-1619682547416.png%22%20alt%3D%22SherrySahni_32-1619682547416.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ESelect%26nbsp%3BSend%26nbsp%3Bto%20call%20the%20API%20successfully.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_33-1619682547459.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276664iB2A7B8BA4F320F29%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_33-1619682547459.png%22%20alt%3D%22SherrySahni_33-1619682547459.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EDetailing%20about%20Client%20Credential%20Flow%3A%3CBR%20%2F%3E%3C%2FSTRONG%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fdevelop%2Fv2-oauth2-client-creds-grant-flow%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fdevelop%2Fv2-oauth2-client-creds-grant-flow%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EAbout%20.default%20scope%3C%2FSTRONG%3E%20%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fdevelop%2Fv2-permissions-and-consent%23the-default-scope%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fdevelop%2Fv2-permissions-and-consent%23the-default-scope%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1817267956%22%20id%3D%22toc-hId--1817267956%22%20id%3D%22toc-hId--1817267956%22%20id%3D%22toc-hId--1817267956%22%20id%3D%22toc-hId--1817267956%22%20id%3D%22toc-hId--1817267956%22%20id%3D%22toc-hId--1817267956%22%3E%3CSTRONG%3EResource%20Owner%20Password%20Credentials%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_34-1619682547469.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276662i4448D3C0AB16C64B%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_34-1619682547469.png%22%20alt%3D%22SherrySahni_34-1619682547469.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3BThe%20Resource%20Owner%20Password%20Credential%20(ROPC)%20flow%20allows%20an%20application%20to%20sign%20in%20users%20by%20directly%20handling%20their%20password.%3C%2FP%3E%0A%3CP%3EThe%20ROPC%20flow%20is%20a%20single%20request%3A%20it%20sends%20the%20client%20identification%20and%20user's%20credentials%20to%20the%20Identity%20Provided%2C%20and%20then%20receives%20tokens%20in%20return.%3C%2FP%3E%0A%3CP%3EThe%20client%20must%20request%20the%20user's%20email%20address%20and%20password%20before%20doing%20so.%20Immediately%20after%20a%20successful%20request%2C%20the%20client%20should%20securely%20release%20the%20user's%20credentials%20from%20memory.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-670244877%22%20id%3D%22toc-hId-670244877%22%20id%3D%22toc-hId-670244877%22%20id%3D%22toc-hId-670244877%22%20id%3D%22toc-hId-670244877%22%20id%3D%22toc-hId-670244877%22%20id%3D%22toc-hId-670244877%22%3E%3CSTRONG%3EResource%20Owner%20Password%20Credentials%20%E2%80%93%20Demo%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CU%3EDisclaimer%3C%2FU%3E%3A%20The%20new%20developer%20portal%20currently%20does%20not%20support%20the%20ROPC%20type%20and%20being%20worked%20upon%20by%20the%20Engineering%20team.%3C%2FP%3E%0A%3CP%3EWe%20will%20be%20covering%20the%20Demo%20in%20Legacy%20Developer%20Portal%20on%20ROPC%20as%20new%20portal%20does%20not%20support%20this%20type%20yet.%3C%2FP%3E%0A%3CP%3EPlease%20note%20that%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fapi-management%2Fdeveloper-portal-deprecated-migration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Elegacy%20portal%3C%2FA%3E%20is%20going%20to%20get%20expired%20in%202023.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EThe%20OAuth2.0%20server%20configuration%20would%20be%20similar%20to%20the%20other%20grant%20types%2C%20we%20would%20need%20select%20the%20Authorization%20grant%20types%20as%20%26nbsp%3BResource%20Owner%20Password%20%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_35-1619682547479.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276663i3555613772A902CB%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_35-1619682547479.png%22%20alt%3D%22SherrySahni_35-1619682547479.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_36-1619682547492.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276667iAA878A53C4CE01F5%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_36-1619682547492.png%22%20alt%3D%22SherrySahni_36-1619682547492.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20also%20specify%20the%20Ad%20User%20Credentials%20in%20the%20Resource%20owner%20password%20credentials%20section%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_37-1619682547501.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276666i2EF1F8F2BACEE3F1%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_37-1619682547501.png%22%20alt%3D%22SherrySahni_37-1619682547501.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPlease%20note%20that%20it%E2%80%99s%20not%20a%20recommended%20flow%20as%20it%20requires%20a%20very%20high%20degree%20of%20trust%20in%20the%20application%20and%20carries%20risks%20which%20are%20not%20present%20in%20other%20grant%20types.%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20that%20you%20have%20configured%20an%20OAuth%202.0%20authorization%20server%2C%20the%20next%20step%20is%20to%20enable%20OAuth%202.0%20user%20authorization%20for%20your%20API.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_38-1619682547516.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276665i13C06D12131BFE76%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_38-1619682547516.png%22%20alt%3D%22SherrySahni_38-1619682547516.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20that%20the%20OAuth%202.0%20user%20authorization%20is%20enabled%20on%20your%20API%2C%20we%20will%20be%20browsing%20to%20the%20legacy%20developer%20portal%20and%20maneuver%20to%20the%20API%20operation%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ESelect%26nbsp%3BResource%20Owner%20Password%20from%20the%20authorization%20drop-down%20list%3C%2FLI%3E%0A%3CLI%3EYou%20will%20get%20a%20popup%20to%20pass%20the%20credentials%20with%20the%20option%20to%20%E2%80%9Cuse%20test%20user%E2%80%9D%20if%20you%20check%20this%20option%20it%20will%20be%20allowing%20the%20portal%20to%20sign%20in%20the%20user%20by%20directly%20handling%20their%20password%20added%20during%20the%20Oauth2.0%20configuration%20and%20generate%20the%20token%20after%20clicking%20on%20Authorize%20button%20%3A%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_39-1619682547518.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276668i863A13747C059E62%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_39-1619682547518.png%22%20alt%3D%22SherrySahni_39-1619682547518.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3EAnother%20option%20is%20to%20uncheck%20the%20%E2%80%9Ctest%20user%E2%80%9D%20and%20Add%20the%20username%20and%20password%20to%20generate%20the%20token%20for%20different%20AD%20User%20and%20hit%20the%20authorize%20button%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_40-1619682547536.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276669iC79D556E9C95D421%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_40-1619682547536.png%22%20alt%3D%22SherrySahni_40-1619682547536.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3EThe%20access%20token%20would%20be%20added%20using%20the%20credentials%20supplied%3A%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_41-1619682547560.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276670i9473DA931BC0A220%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_41-1619682547560.png%22%20alt%3D%22SherrySahni_41-1619682547560.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3ESelect%26nbsp%3BSend%26nbsp%3Bto%20call%20the%20API%20successfully.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_42-1619682547575.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276673i90D49CC271CD5352%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_42-1619682547575.png%22%20alt%3D%22SherrySahni_42-1619682547575.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPlease%20note%20that%20the%20validate%20jwt%20policy%20should%20be%20configured%20for%20preauthorizing%20the%20request%20for%20Resource%20owner%20password%20credential%20flow%20also.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1137209586%22%20id%3D%22toc-hId--1137209586%22%20id%3D%22toc-hId--1137209586%22%20id%3D%22toc-hId--1137209586%22%20id%3D%22toc-hId--1137209586%22%20id%3D%22toc-hId--1137209586%22%20id%3D%22toc-hId--1137209586%22%3E%3CSTRONG%3EThings%20to%20remember%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CUL%3E%0A%3CLI%3EThe%20portal%20needs%20to%20be%20republished%20after%20API%20Management%20service%20configuration%20changes%20when%20updating%20the%20identity%20providers%20settings.%3C%2FLI%3E%0A%3CLI%3EMake%20sure%20to%20specify%20the%20correct%20Oauth%20Authorization%20%26amp%3B%20Token%20endpoint%20in%20OAuth2.0%20configuration%20in%20APIM.%3CBR%20%2F%3E%3CSTRONG%3EFor%20example%20%3A%3CBR%20%2F%3E%3C%2FSTRONG%3E%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%253ctenantID%253e%2Foauth2%2Fv2.0%2Fauthorize%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2Foauth2%2Fv2.0%2Fauthorize%3C%2FTENANTID%3E%3C%2FA%3E%3CU%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FU%3E%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%253ctenantID%253e%2Foauth2%2Fv2.0%2Ftoken%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%3C%2FA%3E%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%253ctenantID%253e%2Foauth2%2Fv2.0%2Ftoken%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%2F%3CTENANTID%3E%3C%2FTENANTID%3E%3C%2FA%3E%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%253ctenantID%253e%2Foauth2%2Fv2.0%2Ftoken%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%26gt%3B%2Foauth2%2Fv2.0%2Ftoken%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EThe%20Client%20App%20registration%20should%20have%20redirect%20url%20for%20the%20APIM%20developer%20portal%3CBR%20%2F%3E%3CBR%20%2F%3E%3CU%3Ehttps%3A%2F%2F%3CAPIM-NAME%3E.developer.azure-api.net%2Fsignin-oauth%2Fimplicit%2Fcallback%3CBR%20%2F%3E%3CBR%20%2F%3E%3D%26gt%3Bhttps%3A%2F%2F%3CAPIM-NAME%3E.developer.azure-api.net%2Fsignin-oauth%2Fcode%2Fcallback%2Foauth-authorizationcodeflow%3C%2FAPIM-NAME%3E%3C%2FAPIM-NAME%3E%3C%2FU%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1350303247%22%20id%3D%22toc-hId-1350303247%22%20id%3D%22toc-hId-1350303247%22%20id%3D%22toc-hId-1350303247%22%20id%3D%22toc-hId-1350303247%22%20id%3D%22toc-hId-1350303247%22%20id%3D%22toc-hId-1350303247%22%3E%3CSTRONG%3ECommon%20issues%20when%20OAuth2.0%20is%20integrated%20with%20API%20Management%3A%26nbsp%3B%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CUL%20class%3D%22lia-list-style-type-square%22%3E%0A%3CLI%3E%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSTRONG%3EProblem%20faced%20while%20%3C%2FSTRONG%3E%3C%2FFONT%3E%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSTRONG%3Eobtaining%3C%2FSTRONG%3E%3C%2FFONT%3E%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSTRONG%3E%20a%20token%20with%20Client%20Credential%20Grant%20Type%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BError%20Snapshot%3C%2FSTRONG%3E%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_43-1619682547599.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276672iD083E9F3C47CAB70%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_43-1619682547599.png%22%20alt%3D%22SherrySahni_43-1619682547599.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESolution%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThis%20error%20indicated%20that%20scope%20%3CU%3Eapi%3A%2F%2Fb29e6a33-9xxxxxxxxx%2FFiles.Read%3C%2FU%3E%20is%20invalid.%3C%2FP%3E%0A%3CP%3EAs%20client_credentials%20flow%20requires%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fauth-v2-service%234-get-an-access-token%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eapplication%20permission%3C%2FA%3E%20to%20work%2C%20but%20you%20may%20be%20passing%20the%20scope%20as%20Files.Read%20which%20is%20a%20delegated%20permission(user%20permission)%20and%20hence%20it%20rejected%20the%20scope.%3CBR%20%2F%3E%3CBR%20%2F%3ETo%20make%20it%20work%2C%20we%20would%20need%20to%20use%20default%20application%20scope%20as%26nbsp%3B%20%3CSTRONG%3E%E2%80%9Capi%3A%2F%2FbackendappID%2F.default%E2%80%9D%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CUL%20class%3D%22lia-list-style-type-square%22%3E%0A%3CLI%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3CSTRONG%3E%3CFONT%20color%3D%22%2300CCFF%22%3EReceiving%20%E2%80%9C401%20Unauthorized%E2%80%9D%20response%3C%2FFONT%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3CSTRONG%3ESolution%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3EYou%20may%20be%20observing%20401%20unauthorized%20response%20returned%20by%20validate-jwt%20policy%2C%20its%20is%20recommended%20to%20look%20at%20the%20aud%20claims%20in%20the%20passed%20token%20and%20validate-jwt%20policy.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSTRONG%3E%3CBR%20%2F%3E%3C%2FSTRONG%3EYou%20can%20decode%20the%20token%20at%20%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fjwt.io%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fjwt.io%2F%3C%2FA%3E%20and%20reverify%20it%20with%20the%20validate-jwt%20policy%20used%20in%20inbound%20section%3A%3CBR%20%2F%3EFor%20example%3A%3C%2FP%3E%0A%3CP%3EThe%20Audience%20in%20the%20decoded%20token%20payload%20should%20match%20to%20the%20claim%20section%20of%20the%20validate-jwt%20policy%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SherrySahni_44-1619682547610.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276671iABC6A19C4B01E1E4%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SherrySahni_44-1619682547610.png%22%20alt%3D%22SherrySahni_44-1619682547610.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CCLAIM%20name%3D%22%26quot%3Baud%26quot%3B%22%3E%3C%2FCLAIM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CVALUE%3Eapi%3A%2F%2Fb293-9f6b-4165-xxxxxxxxxxx%3C%2FVALUE%3E%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%20class%3D%22lia-list-style-type-square%22%3E%0A%3CLI%3E%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3CSTRONG%3EValidate-JWT%20policy%20fails%20with%20IDX10511%3A%20Signature%20validation%20failed%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSTRONG%3EWhen%20we%20go%20to%20test%20the%20API%20and%20provide%20a%20JWT%20token%20in%20the%20Authorization%20header%20the%20policy%20may%20fail%20with%20the%20following%20error%3A%20%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%20IDX10511%3A%20Signature%20validation%20failed%3C%2FSTRONG%3E.%20Keys%20tried%3A%20'Microsoft.IdentityModel.Tokens.X509SecurityKey%20%2C%20KeyId%3A%20CtTuhMJmD5M7DLdzD2v2x3QKSRY%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESolution%20%3A%3CBR%20%2F%3E%3C%2FSTRONG%3EIf%20you%20look%20at%20the%20metadata%20for%20the%20config%20url%20(%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2F.well-known%2Fopenid-configuration%3C%2FA%3E)you%20will%20find%20a%20jwks_uri%20property%20inside%20the%20resulting%20json.%3C%2FP%3E%0A%3CP%3EThis%20uri%20will%20point%20to%20a%20set%20of%20certificates%20used%20to%20sign%20and%20validate%20the%20jwt's.%26nbsp%3B%20You%20may%20find%20that%20the%20keyId%20(in%20this%20sample%20%22%3CSTRONG%3ECtTuhMJmD5M7DLdzD2v2x3QKSRY%3C%2FSTRONG%3E%22)%20does%20exist%20there.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESomething%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%7B%3C%2FP%3E%0A%3CP%3E%22keys%22%3A%20%5B%7B%3C%2FP%3E%0A%3CP%3E%22kty%22%3A%20%22RSA%22%2C%3C%2FP%3E%0A%3CP%3E%22use%22%3A%20%22sig%22%2C%3C%2FP%3E%0A%3CP%3E%22kid%22%3A%20%22%3CSTRONG%3ECtTuhMJmD5M7DLdzD2v2x3QKSRY%3C%2FSTRONG%3E%22%2C%3C%2FP%3E%0A%3CP%3E%22x5t%22%3A%20%22CtTuhMJmD5M7DLdzD2v2x3QKSRY%22%2C%3C%2FP%3E%0A%3CP%3E%22n%22%3A%20%2218uZ3P3IgOySln%E2%80%A6%E2%80%A6%22%2C%3C%2FP%3E%0A%3CP%3E%22e%22%3A%20%22AQAB%22%2C%3C%2FP%3E%0A%3CP%3E%22x5c%22%3A%20%5B%22MII%E2%80%A6..%22%5D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20it%20seems%20that%20it%20should%20be%20able%20to%20validate%20the%20signature.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20look%20at%20the%20decoded%20jwt%20you%20may%20see%20something%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%7B%3C%2FP%3E%0A%3CP%3E%22typ%22%3A%20%22JWT%22%2C%3C%2FP%3E%0A%3CP%3E%22alg%22%3A%20%22RS256%22%2C%3C%2FP%3E%0A%3CP%3E%22x5t%22%3A%20%22CtTuhMJmD5M7DLdzD2v2x3QKSRY%22%2C%3C%2FP%3E%0A%3CP%3E%22kid%22%3A%20%22CtTuhMJmD5M7DLdzD2v2x3QKSRY%22%3C%2FP%3E%0A%3CP%3E%7D%3C%2FP%3E%0A%3CP%3E.%7B%3C%2FP%3E%0A%3CP%3E%22aud%22%3A%20%2200000003-0000-0000-c000-000000000000%22%2C%3C%2FP%3E%0A%3CP%3E%22iss%22%3A%20%22%3CA%20href%3D%22https%3A%2F%2Fsts.windows.net%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fsts.windows.net%2F%3CTENANTID%3E%2F%3C%2FTENANTID%3E%3C%2FA%3E%22%2C%3C%2FP%3E%0A%3CP%3E%22appid%22%3A%20%221950a258-227b-4e31-a9cf-717495945fc2%22%2C%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%22nonce%22%3A%20%22da3d8159-f9f6-4fa8-bbf8-9a2cd108a261%22%2C%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere's%20a%20nonce%20in%20play%20here.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20requires%20extra%20checking%20that%20validate-jwt%20does%20not%20do.%20%26nbsp%3BGetting%20a%20token%20for%20the%20Graph%20api%20and%20Sharepoint%20may%20emit%20a%20nonce%20property.%26nbsp%3B%20A%20token%20used%20to%20make%20calls%20to%20the%20Azure%20management%20api%2C%20however%2C%20will%20not%20have%20the%20nonce%20property.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20'nonce'%20is%20a%20mechanism%2C%20that%20allows%20the%20receiver%20to%20determine%20if%20the%20token%20was%20forwarded.%20The%20signature%20is%20over%20the%20transformed%20nonce%20and%20requires%20special%20processing%2C%20so%20if%20you%20try%20and%20validate%20it%20directly%2C%20the%20signature%20validation%20will%20fail.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20validate%20jwt%20policy%20is%20not%20meant%20to%20validate%20tokens%20targeted%20for%20the%20Graph%20api%20or%20Sharepoint.%26nbsp%3B%20The%20best%20thing%20to%20do%20here%20is%20either%20remove%20the%20validate%20jwt%20policy%20and%20let%20the%20backend%20service%20validate%20it%20or%20use%20a%20token%20targeted%20for%20a%20different%20audience.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%20class%3D%22lia-list-style-type-square%22%3E%0A%3CLI%3E%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSTRONG%3EValidate-JWT%20policy%20fails%20with%20IDX10205%3A%20Issuer%20validation%20failed%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EHere%20is%20an%20example%20configuration%20a%20user%20might%20have%20added%20to%20their%20policy%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CVALIDATE-JWT%20header-name%3D%22%26quot%3BAuthorization%26quot%3B%22%20failed-validation-httpcode%3D%22%26quot%3B401%26quot%3B%22%20failed-validation-error-message%3D%22%26quot%3BUnauthorized.%22%20access%3D%22%22%20token%3D%22%22%20is%3D%22%22%20missing%3D%22%22%20or%3D%22%22%20invalid.%3D%22%22%3E%3C%2FVALIDATE-JWT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3COPENID-CONFIG%20url%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%3C%2FA%3E%22%20%2F%26gt%3B%3C%2FOPENID-CONFIG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CREQUIRED-CLAIMS%3E%3C%2FREQUIRED-CLAIMS%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCLAIM%20name%3D%22%26quot%3BAud%26quot%3B%22%20match%3D%22%26quot%3Bany%26quot%3B%22%3E%3C%2FCLAIM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CVALUE%3Eapi%3A%2F%2F72f988bf-86af-91ab-2d7cd011db47%3C%2FVALUE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20a%20we%20go%20to%20test%20that%20API%20and%20provide%20a%20JWT%20token%20in%20the%20Authorization%20header%20the%20policy%20may%20fail%20with%20the%20following%20error%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EIDX10205%3C%2FSTRONG%3E%3A%20%3CSTRONG%3EIssuer%20validation%20failed.%20Issuer%3A%3C%2FSTRONG%3E%20'%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2Fv2.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86af-91ab-2d7cd011db47%2Fv2.0%3C%2FA%3E'.%20%3CSTRONG%3EDid%20not%20match%3A%20validationParameters.ValidIssuer%3A%20''%20or%20validationParameters.ValidIssuers%3A%3C%2FSTRONG%3E%20'%3CA%20href%3D%22https%3A%2F%2Fsts.windows.net%2F72f988bf-86af-91ab-2d7cd011db47%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fsts.windows.net%2F72f988bf-86af-91ab-2d7cd011db47%2F%3C%2FA%3E'.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESolution%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThis%20error%20message%20gets%20thrown%20when%20the%20Issuer%20(%22iss%22)%20claim%20in%20the%20JWT%20token%20does%20not%20match%20the%20trusted%20issuer%20in%20the%20policy%20configuration.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20Active%20Directory%20offers%20two%20versions%20of%20the%20token%20endpoint%2C%20to%20support%20two%20different%20implementations.%20AAD%20also%20exposes%20two%20different%20metadata%20documents%20to%20describe%20its%20endpoints.%3C%2FP%3E%0A%3CP%3EThe%20OpenID%20Config%20files%20contains%20details%20about%20the%20AAD%20tenant%20endpoints%20and%20links%20to%20its%20signing%20key%20that%20APIM%20will%20use%20to%20verify%20the%20signature%20of%20the%20token.%20Here%20are%20the%20details%20of%20those%20two%20endpoints%20and%20documents%20(for%20the%20MSFT%20AAD%20tenant)%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20AD%20Token%20Endpoint%20%3CSTRONG%3EV1%3C%2FSTRONG%3E%3A%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%253ctenantID%253e%2Foauth2%2Ftoken%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2Foauth2%2Ftoken%3C%2FTENANTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EAzure%20AD%20OpenID%20Config%20%3CSTRONG%3EV1%3C%2FSTRONG%3E%3A%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2F.well-known%2Fopenid-configuration%3C%2FTENANTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20AD%20Token%20Endpoint%20%3CSTRONG%3EV2%3C%2FSTRONG%3E%3A%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2Foauth2%2Fv2.0%2Ftoken%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2Foauth2%2Fv2.0%2Ftoken%3C%2FTENANTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EAzure%20AD%20OpenID%20Config%20%3CSTRONG%3EV2%3C%2FSTRONG%3E%3A%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2Fv2.0%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CTENANTID%3E%2Fv2.0%2F.well-known%2Fopenid-configuration%3C%2FTENANTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EError%20Details%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20error%20usually%20occurs%20because%20the%20user%20is%20using%20a%20mix%20between%20V1%20and%20V2.%20So%20they%20request%20a%20token%20from%20V1%20endpoint%20but%20configured%20%3COPENID-CONFIG%3E%20setting%20pointing%20to%20V2%20endpoint%2C%26nbsp%3B%20or%20vice%20versa.%3C%2FOPENID-CONFIG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20Azure%20AD%20%3CSTRONG%3EV1%20endpoint%3C%2FSTRONG%3E%20uses%20an%20issuer%20value%20of%20%3CA%20href%3D%22https%3A%2F%2Fsts.windows.net%2F%257btenant-id-guid%257d%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fsts.windows.net%2F%7Btenant-id-guid%7D%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThe%20Azure%20AD%20%3CSTRONG%3EV2%20endpoint%3C%2FSTRONG%3E%20uses%20an%20issuer%20value%20of%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%257btenant-id-guid%257d%2Fv2.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant-id-guid%7D%2Fv2.0%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20resolve%20this%20issue%20you%20just%20need%20to%20make%20sure%20the%20%3CVALIDATE-JWT%3E%20policy%20is%20loading%20up%20the%20matching%20openid-config%20file%20to%20match%20the%20token.%20The%20easiest%20way%20is%20to%20just%20toggle%20the%20open-id%20config%20url%20within%20the%20policy%20and%20then%20it%20will%20move%20beyond%20this%20part%20of%20the%20validation%20logic.%3C%2FVALIDATE-JWT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CVALIDATE-JWT%20header-name%3D%22%26quot%3BAuthorization%26quot%3B%22%20failed-validation-httpcode%3D%22%26quot%3B401%26quot%3B%22%20failed-validation-error-message%3D%22%26quot%3BUnauthorized.%22%20access%3D%22%22%20token%3D%22%22%20is%3D%22%22%20missing%3D%22%22%20or%3D%22%22%20invalid.%3D%22%22%3E%3C%2FVALIDATE-JWT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3COPENID-CONFIG%20url%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant-id-guid%7D%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant-id-guid%7D%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant-id-guid%7D%2F.well-known%2Fopenid-configuration%3C%2FA%3E%22%20%2F%26gt%3B%3C%2FOPENID-CONFIG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EFind%20the%20%3COPENID-CONFIG%3E%20setting%20in%20their%20policy%3C%2FOPENID-CONFIG%3E%3C%2FLI%3E%0A%3CLI%3EJust%20switch%20out%20the%20openid-config%20url%20between%20the%20two%20formats%2C%20replace%20%7Btenant-id-guid%7D%20with%20the%20Azure%20AD%20Tenant%20ID%20which%20you%20can%20collect%20from%20the%20Azure%20AD%20Overview%20tab%20within%20the%20Azure%20Portal%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F72f988bf-86f1-41af-91ab-2d7cd011db47%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CEM%3E%7Btenant-id-guid%7D%3C%2FEM%3E%2F.well-known%2Fopenid-configuration%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20---%20or%20----%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%257btenant-id-guid%257d%2Fv2.0%2F.well-known%2Fopenid-configuration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CEM%3E%7Btenant-id-guid%7D%3C%2FEM%3E%2Fv2.0%2F.well-known%2Fopenid-configuration%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2309538%22%20slang%3D%22en-US%22%3E%3CP%3EProtect%20API's%20using%20OAuth%202.0%20in%20APIM%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2309538%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20API%20management%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2563623%22%20slang%3D%22en-US%22%3ERe%3A%20Protect%20API's%20using%20OAuth%202.0%20in%20APIM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2563623%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20the%20excellent%20Article.%20I%20got%20stucked%20in%20one%20cases%20for%20last%20three%20week%20can%20you%20please%20guide-%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20to%20call%20this%20APIM%20from%20logic%20app%20with%20Bearer%20token%20.Do%20i%20need%20to%20generate%20the%20token%20first%3F%20If%20yes%20can%20you%20please%20tell%20me%20the%20process%20to%20call%20APIM%20from%20Azure%20Logic%20APP%20with%20bearer%20token%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2322607%22%20slang%3D%22en-US%22%3ERe%3A%20Protect%20API's%20using%20OAuth%202.0%20in%20APIM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2322607%22%20slang%3D%22en-US%22%3E%3CP%3EGreat%20material!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Co-Authors
Version history
Last update:
‎May 06 2021 07:40 AM
Updated by: