Question

I've some difficulty providing a login form for authentication with onedrive.

The scenario: a Windows 7 software is made to retrieve and upload some data, a user should login into onedrive (personal onedrive) to achieve this.

According to this doc (http://msdn.microsoft.com/en-US/library/dn631823.aspx) I should write:

    var authClient = new LiveAuthClient();
    LiveLoginResult result = await authClient.LoginAsync("wl.signin", "wl.skydrive");

    if (result.Status == LiveConnectSessionStatus.Connected)
    {
        connected = true;
        var connectClient = new LiveConnectClient(result.Session);
        var meResult = await connectClient.GetAsync("me");
        dynamic meData = meResult.Result;
        updateUI(meData);
    }
}

In my version (the last one) of live sdk I must optain an API key:

        var _authClient = new LiveAuthClient("000xxxxxxxxxxxxxxxx"); //LiveAuthClient() simply not exist

        var scopes = new string[] { "wl.signin", "wl.skydrive" }; // "wl.skydrive_update"

        LiveLoginResult result = await _authClient.InitializeAsync(scopes);




        if (result.Status == LiveConnectSessionStatus.Connected)
        {

            Debug.WriteLine("Connected");

        }

The problem is that I can't find LoginAsync method and why must I obtain an API key? I'm a bit confused. Thanks.

Was it helpful?

Solution

You should see a "GetLoginUrl" method that you can use to render the login page for the user. Here's a link to a sample application that shows you how this can be accomplished:

https://github.com/liveservices/LiveSDK-for-Windows/tree/master/src/Desktop/Samples/ApiExplorer

OTHER TIPS

Try reading this doc on Desktop apps: http://msdn.microsoft.com/en-us/library/dn631817.aspx It shows a different way to provide login on desktop.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top