windows phone 8.1 - Onedrive API vs LiveSDK -
i developping wp8.1 , port on other plateforms. want integrate onedrive functionality, can't understand difference between livesdk (from nuget packages) , onedrive api https://dev.onedrive.com seems microsoft not communicate @ regarding that, don't understand why. far understood, livesdk old 1 , replaced onedrive api, livesdk seems simpler use can't understand logic... on top of both have been updated (in april livesdk).
so question is: long app has not been published yet, should move onedrive api, or keep on livesdk? have tried both? limitations , benefits of both?
based on future-proof sight, go onedrive api, main concern is:
is possible login on onedrive api live sdk? (working temporary solution below)
for now, have been able login livesdk using single button , 3 lines of code, no user input required @ all, authenticateandcontinue method used onedrive api opens webcontrol , requires enter manually login , password.
at end have used livesdk authentication , use access token provided onedrive api. not clean approach point of view, couldn't manage authenticateandcontinue method work (i 404 error answer after login).
if has better solution, opened suggestions :)
in summary, current method following:
- authenticate using livesdk api
- use session cookie , onedrive api there
the simplified code following:
the method below allows log in silently, first time requires manual validation user allowing program use live account.
it not require password user
var authclient = new liveauthclient(); var authresult = await authclient.loginasync(new string[] { "wl.signin", "onedrive.readwrite", "onedrive.appfolder"}); if (authresult.session == null) throw new invalidoperationexception("you need sign in , give consent app."); var connection = new odconnection("https://api.onedrive.com/v1.0", new microsoftaccountauthenticationinfo() { tokentype = "bearer", accesstoken = odargs.session.accesstoken }); it not clean (using 2 different sdk), works :)
Comments
Post a Comment