Reputation: 1668
I have asp.net core 3.1 Web API project that needs to call Microsoft Azure API ( for e.g. Storage API on behalf of other user (Impersonation).
I believe this can be achieved by Azure App Registration and then creating Impersonation for user by acquiring token interactive first and then silently with Microsoft.Identity.Client library.
Any examples would be helpful...
Upvotes: 1
Views: 1677
Reputation: 27588
You can implement getting tokens on behalf of a user (Service to service calls) use on-behalf-of flow (OBO) with MSAL , you can check the document & code snippets from document here using MSAL 2.3 + .
Upvotes: 1
Reputation: 15639
If your web api is protected by Azure AD, you can use On behalf of flow. Here is the scenario regarding a web API that calls web APIs.
If your web api is not protected by Azure AD and you want to use user token, you must use interactive authentication or ropc flow to call Azure API.
Reference:
Web API calling Microsoft Graph.
Upvotes: 0