Search code examples
c#permissionsdesktop-applicationlive-sdkonedrive

How to use OneDrive's api in desktop app and remember permission?


OneDrive can be develope in windows desktop app、window store app.

http://msdn.microsoft.com/en-us/library/dn631817.aspx

https://github.com/liveservices/LiveSDK-for-Windows

I also try the sample apps.

In windows store app, it will remember userID、password and permission until I set to sign-out.

But in windows desktop app, when I launch the desktop's app, it always ask user's permission.

How can I remember the user's permission?

Does anyone have similar experiences?


Solution

  • When you initialize your AuthClient you need to pass in some Scopes that grant permissions to different privileges, a number of these scopes affect preserving login information, namely: wl.signin and wl.offline_access

    These scopes will allow your application to sign in and the persist the credentials over multiple sessions.

    There is a sample project avaliable (in Android not C#) which more or less what you are looking for: https://github.com/peternied/LiveLogin