You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can I use MsaAuthenticationProvider for receive token for both OneDrive and Microsoft Graph services ?
I need Microsoft Graph for reading information about current logged user (because OneDrive SDK hasn't such method). But, if I add scope "User.Read" to scope array, msaAuthProvider.AuthenticateUserAsync() will generate exception after user authentication.
stringAppKey="APP_ID";stringAppRedirect="https://login.live.com/oauth20_desktop.srf";string[]AppScopes={"User.Read","offline_access","onedrive.readwrite"};varmsaAuthProvider=newMsaAuthenticationProvider(AppKey,AppRedirect,AppScopes,newCredentialVault(AppKey));awaitmsaAuthProvider.AuthenticateUserAsync();//!< produces Microsoft.Graph.ServiceException exception after authenticationvarclient=newOneDriveClient("https://api.onedrive.com/v1.0",msaAuthProvider);
Exception data:
Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary System.Collections.ListDictionaryInternal}
Error {Code: generalException Message: Unexpected exception returned from the service. } Microsoft.Graph.Error
Small addition. Such code (token for OneDrive) works fine.
hi @23W the MSA provider only works MSA OAuth which you can see it goes to login.live.com/oauth while unfortunately it won't work with Microsoft Graph Service which talks to Azure AD OAuth V2, I would suggest you use the MSAL library for talking with Microsoft Graph Service. Sorry for these confusing OAuth definitions, for detail you can see my answer here: OneDrive/onedrive-sdk-csharp#216.
Can I use MsaAuthenticationProvider for receive token for both OneDrive and Microsoft Graph services ?
I need Microsoft Graph for reading information about current logged user (because OneDrive SDK hasn't such method). But, if I add scope "User.Read" to scope array, msaAuthProvider.AuthenticateUserAsync() will generate exception after user authentication.
Exception data:
Small addition. Such code (token for OneDrive) works fine.
Such code (token for access to User profile) works fine, too.
But together it will generate exception. Why so?
The text was updated successfully, but these errors were encountered: