How to configure app registration to display scope of "dependent" app registration in consent screen?

Matthias Grosperrin 0 Reputation points
2023-08-09T07:40:24.2466667+00:00

Hi,

I am building a set of WebApp & API, one depending on the others, and I am trying to configure the app registrations to propose the simpliest consent scenario to my users.

Ideally, I would like to have only one consent screen, showing the scopes for the WebApp itself and the scopes for all "dependent" API.

For now, I am able to configure the app registrations with the preAuthorizedApplications and knownClientApplications but it "only" allow me to request an access token for the API. This token doesn't allow the API to request token to call MS Graph API (for example).

Is there a way to do it?

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 30,431 Reputation points Microsoft Employee Moderator
    2023-08-10T07:31:29.1733333+00:00

    Hi @Matthias Grosperrin ,

    Thanks for reaching out.

    You can achieve this by using the On-Behalf-Of flow. The On-Behalf-Of flow is used to obtain a token to call a downstream API, on behalf of a user. In your case, the WebApp will obtain an access token for itself and an access token for the API, on behalf of the user. The API can then use the access token it obtained to call the Microsoft Graph API.

    To implement the On-Behalf-Of flow, you need to configure the app registrations for both the WebApp and the API. The WebApp will need to request an access token for itself and an access token for the API, using the user's access token. The API will need to validate the access token it received from the WebApp and use it to call the Microsoft Graph API.

    Reference - https://www.youtube.com/watch?v=M5yXU6oWchU

    https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow

    Hope this will help.

    Thanks,

    Shweta


    Please remember to "Accept Answer" if answer helped you.


Your answer

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