[FEATURE REQ] : Passing scopes to EnableTokenAcquisitionToCallDownstreamApi() vs AddMicrosoftGraph()
See original GitHub issueWe need to streamline and document the right way to pass scopes to EnableTokenAcquisitionToCallDownstreamApi() vs AddMicrosoftGraph()
What is the difference between passing scopes to EnableTokenAcquisitionToCallDownstreamApi vs AddMicrosoftGraph Which one should be used?
//Sign -in users with the Microsoft identity platform(MSAL)
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAd"))
.EnableTokenAcquisitionToCallDownstreamApi()
.AddMicrosoftGraph(defaultScopes: "User.Read User.ReadBasic.All")
.AddInMemoryTokenCaches();
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAd"))
.EnableTokenAcquisitionToCallDownstreamApi(initialScopes: new string[] { "User.Read", "User.ReadBasic.All" })
.AddMicrosoftGraph()
.AddInMemoryTokenCaches();
Can we change AddMicrosoftGraph() to accept an array of scopes instead of scopes separated by space?
.AddMicrosoftGraph(defaultScopes: new string[] { "User.Read", "User.ReadBasic.All" })
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
A web API that calls web APIs: Code configuration
A web API needs to acquire a token for the downstream API. Specify it by adding the .EnableTokenAcquisitionToCallDownstreamApi() line after .
Read more >asp.net core - Unable to set scopes with ...
EnableTokenAcquisitionToCallDownstreamApi (initialScopes) .AddMicrosoftGraph();. However, since I'm working on an API controller only, and not a ...
Read more >Implementing OAuth 2.0 On-Behalf-Of Flow for Dataverse ...
In this flow, the objective is to propagate the delegated user identity and permissions throughout the entire request chain.
Read more >Using Microsoft Graph API delegated clients in ASP.NET Core
The AddMicrosoftGraph method is used to add the required scopes for your Graph API calls. The AddMicrosoftIdentityWebAppAuthentication method is ...
Read more >Addinmemorytokencaches get token. Web). In-memory ...
I had issues like this when trying to add Azure AD (Microsoft) authentication to my ASP. The MSAL library for . The project...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @KalyanChanumolu-MSFT for the update We can have a override to AddMicrosoftGraph to accept an array of scopes (even with a params)
@jennyf19 proposing to do something about this one.
Adding an enhancement label, so that we try to register the initialScopes if not passed to EnableTokenAcquisitionToCallDownstreamApi (if possible)