My solution has two app regs - Client and API.
I am setting up a On-Behalf-Of OAuth flow with the goal to allow user to perform Graph User query with User.ReadBasic.All permission without requiring admin consent.
Following this guide, API app reg exposes a custom scope "Portal.ReadWrite.All" and sets Client app reg as knownClientApplication as well as preAuthorizedApplication; The custom scope is then added to the Client app reg permission list.
Client app authenticates to API using MSAL, with the "Portal.ReadWrite.All" scope. From my understanding of OBO flow, we can then exchange that MSAL token which was used to authenticate into API using this call with the assertion=<MSAL token> and scope=User.ReadBasic.All, which should return a new token with User.ReadBasic.All scope.
However when I make the call to exchange the token, I got following error indicating admin consent is required.
AADSTS65001: The user or administrator has not consented to use the application with ID '<api-app-reg-id>' named '<API App Reg Name>'. Send an interactive authorization request for this user and resource.
I then granted the consent to the enterprise application using an admin account, the call succeeded and the token has the User.ReadBasic.All scope as expected. This confirms that admin consent is indeed required to exchange the token with the scope via OBO.
My questions:
Given Delegated User.ReadBasic.All allows user consent as per documentation, is admin consent supposed to be required when using the OBO flow?
If not, what is the configuration mistake that I have made judging from above description?
If so, is there any method/workaround that could achieve my goal to allow user to perform Graph User query with User.ReadBasic.All permission without requiring admin consent?
Many thanks