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

How to obtain the Access token that this MSAL wrapper obtained for MS Graph #57

Closed kalyankrishna1 closed 4 years ago

kalyankrishna1 commented 4 years ago

We cannot use the SDK for all the calls, like when using Batching and intermixing beta and prod (1.0) endpoints. In these cases we sometime needs to make a direct REST Api call using a HttpClient. This forces us to fall back on MSAL for an access token and re-Authenticate the user again.

Please consider providing a property, or better a method (preferred as I think the call to AAD is delayed till the actual SDK method is called) that will contain the current AccessToken pulled from the token Cache

kalyankrishna1 commented 4 years ago

Found the following method, it works

await graphServiceClient.AuthenticationProvider.AuthenticateRequestAsync(batchRequest);