OneDrive / onedrive-sdk-dotnet-msa-auth-adapter

Other
26 stars 22 forks source link

Failure during access token acquisition via refresh token causes useless exception #32

Open shiftylogic opened 7 years ago

shiftylogic commented 7 years ago

This is an issue filed against the Microsoft Graph .NET library that we are moving here since it is actually being triggered by the OneDrive auth provider. The original issue is here filed by @oatsoda.

If a failure happens during acquisition of an access token via refresh token (user changes password, revokes app, etc), the Microsoft Graph Core HttpProvider attempts to deserialize the OAuth error and it fails. The reason is that the HttpProvider built into Microsoft Graph Core was meant for processing OData requests that honor a very specific error format. The OAuth error (and any other error for that matter) likely won't match that pattern and therefore the deserialization fails. We catch that exception but end up throwing a very generic exception instead. This loses all the valuable information that the developer could have used to debug this issue.

The HttpProvider was not written to be used outside the context of making OData calls. I'm not sure that the MSA Auth Provider should be using the HttpProvider inside Microsoft.Graph.Core.dll for doing authentication related work. In the regular Microsoft Graph library, we use MSAL for all our authentication needs so do not have this same issue.

FYI @cbales

oatsoda commented 7 years ago

FYI I originally logged this as issue 31 but closed it when I thought it was either a Graph SDK issue or a problem with the OneDrive API itself.

oatsoda commented 7 years ago

Is there any comment on this issue? We see a lot of exceptions in our client code when a user has changed their password or have revoked their token etc...

23W commented 7 years ago

I have the same problem. If user has rejected application on its app managing page, code will receive "general exception" without any useful information. Looks like this lib is no supported, isn't it?

oatsoda commented 5 years ago

Is this SDK still being maintained? Are we supposed to still be using it?