KoenZomers / OneDriveAPI

API in .NET Framework 4.8.0, .NET Core 3.1 and .NET 6.0 to communicate with OneDrive Personal and OneDrive for Business
Eclipse Public License 1.0
110 stars 35 forks source link

RefreshToken #17

Closed Sejushi closed 5 years ago

Sejushi commented 5 years ago

Hi, I'm using OneDriveGraphApi to uploading files. with function OneDriveApi.AuthenticateUsingRefreshToken.

Everything works very well but my refresh token is changing after few weeks and I have to put into my code new token... what I should do to avoid this problem?

KoenZomers commented 5 years ago

On the OneDriveApi instance on which you call AuthenticateUsingRefreshToken you will find a property called AccessToken which is of type OneDriveAccessToken. This on its turn has a property RefreshToken. After doing your authentication, simply get the value of this RefreshToken and update your local config to use that the next time. It should work for up to about 3 months I believe it is at present. Then it will stop working. This is by design. Not sure if there’s an option already by now to overrule that. Haven’t checked recently.

KoenZomers commented 5 years ago

Closing this item as there have not been any updates.