Implicitly getting access token for app1 using app2 resource in Azure active directory

Kapil, A (Apurva) 21 Reputation points
2021-05-14T13:55:29.807+00:00

Hello,

While developing Application based OAuth flow, we identify that application1 can request access token for another application2 using resource id(application id) implicitly.

However this shouldn't be a case there should be a proper access mechanism for application1 to request access token for application2.

Current Scenarios:

Provider creates an application(Application2) in AAD and adds app roles.

Consumer creates an application(Application1) in AAD and use Application2's application id to get a access token.

Output:

Application1 receives an access token with no app-roles.

Desired output:

Application1 shouldn't be able to generate token for application2 , since it doesn't have access to application2.

Microsoft Security Microsoft Entra Microsoft Entra ID
{count} votes

Accepted answer
  1. AmanpreetSingh-MSFT 56,866 Reputation points Moderator
    2021-05-20T14:12:50.033+00:00

    Hi @Kapil, A (Apurva) · Thank you for sharing required information.

    As you have mentioned in your current scenario, Provider creates an application(Application2) in AAD and adds app roles. The purpose of app roles is to perform authorization, and based on app role(s) in the token, required access can be granted. E.g., In your case application2 must be configured to authorize read access if the value of Roles claim is read in the token acquired and presented by Application1 and write access if the value of roles claim is write, for instance.

    You can acquire a token with scope APPLICATION_ID_OF_APP2/.default but it will include Roles claim and Application2 needs to be configured to return HTTP Forbidden or Unauthorized, if Roles claim is not present in the token. A token without roles claim should be of no use.

    In order to get a token with Roles claim, the App Roles defined in the Application2, must be added as application permissions under API permissions blade of Application1 and admin consent must be granted.

    Read More: https://learn.microsoft.com/en-us/azure/active-directory/develop/howto-add-app-roles-in-azure-ad-apps

    Hope that helps clarifying your doubt.

    -----------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


0 additional answers

Sort by: Most helpful

Your answer

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