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

Other
26 stars 22 forks source link

Expired token causes full OAuth flow #60

Closed escape-llc closed 6 years ago

escape-llc commented 6 years ago

On UWP desktop, after the token expires, the logon flow leads user again through all the pages of the flow:

  1. enter email.
  2. enter password.
  3. consent to privileges requested.

Instead of:

  1. (re-)enter password.

I would expect (an expired session) to work the same way all the other authorization flows work, and that is user only answers all 3 screens the Very First Time (or after other account changes) but otherwise just re-enters password to refresh the token.

Is there some special undocumented call sequence that avoids this? I am using both CredentialCache and CredentialVault with MsaAuthenticationProvider and RestoreMostRecentFromCacheOrAuthenticateUserAsync what is the magic incantation to make this all work "properly"?

Also, I've never seen a Refresh Token come back in the AccountSession why does that always come back as null?

escape-llc commented 6 years ago

Sorry to say i solved this and not with this package! I switched to the MS Graph packages, and everything works like I expected it to. Remove the OneDrive packages and install these instead:

Only thing to be aware of is you must use MS Graph scopes, e.g. "Files.ReadWrite".

This gets you OneDrive PLUS everything else.