Azure AD OAuth 2.0 token endpoint

Pedro Reinoso 1 Reputation point
2022-06-02T17:23:27.92+00:00

How do I configure a policy in APIM that will work with a token generated by the Azure AD OAuth 2.0 token endpoint?

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

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 29,261 Reputation points
    2022-06-03T16:38:28.067+00:00

    @Pedro Reinoso Thanks for reaching out. I believe you wanted to pre-authorize the token from the incoming request by writing a policy in APIM before sending it to the backend correct me if am wrong here

    If yes, you can write Validate JWT policy in Inbound section to pre-authorize requests with AD token as below

        <inbound>  
            <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/common/v2.0/.well-known/openid-configuration" />  
                <required-claims>  
                    <claim name="aud">  
                        <value>{client-id}</value>  
                    </claim>  
                </required-claims>  
            </validate-jwt>  
        </inbound>  
    

    please refer this blog which explains step by steps process of protecting api's using oauth2.0 in APIM.
    For simple token validation samples please refer this doc

    Hope this helps! Please let me know incase of further queries, I would be happy to assist you.

    1 person found this answer helpful.
    0 comments No comments

Your answer

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