microsoftgraph / msgraph-sdk-dotnet-auth

Archived - use the TokenCredential classes provided by Azure.Identity. https://docs.microsoft.com/en-us/dotnet/api/overview/azure/identity-readme
https://graph.microsoft.com
MIT License
78 stars 19 forks source link

On Behalf Of Not working when Azure AD is Enabled for Web API .Net Framework #90

Closed BatsIhor closed 3 years ago

BatsIhor commented 3 years ago

Hi all, Here is my situation, I have enabled AzureAD authentication on app, with App Registration and Delegated User.Read permission so only authenticated users can access it. As result I receive Headers with "X-MS-...."

From those headers and claims I know who is accessing my app but I want to get more info about user using Graph "/me/memberOf" endpoint.

So "on behalf" look like the right way to go, but it's not working. In your example you use "Request.Headers.Authorization.Parameter; " which is empty in my case. I have all the X-MS-.... but access-key that is in that header is not working.

From my side I have user info, I have clientId/Secret/TenandIt and X-MS headers, can I use on behalf without Authorization header?

MIchaelMainer commented 3 years ago

We suggest that you use Microsoft.Identity.Web for this scenario. Checkout this resource: https://channel9.msdn.com/Shows/On-NET/Authentication-with-Graph-SDKs