2

i'm new to Live SDK and i'm trying to use it to connect to a user's profile and get data from it i have read about it and used the following code to login to user's account

private async void btnSignin_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e)
{
    if (e.Status == LiveConnectSessionStatus.Connected)
    {
        session = e.Session;
        client = new LiveConnectClient(session);
        try
        {
            LiveAuthClient auth = new LiveAuthClient(btnSignin.ClientId);
            //LiveLoginResult initializeResult = await auth.InitializeAsync();
            try
            {
                LiveLoginResult loginResult = await auth.LoginAsync(new string[] { "wl.basic" });
                if (loginResult.Status == LiveConnectSessionStatus.Connected)
                {
                    LiveConnectClient connect = new LiveConnectClient(auth.Session);
                    LiveOperationResult operationResult = await connect.GetAsync("me");
                    dynamic result = operationResult.Result;
                    if (result != null)
                    {
                        this.infoTextBlock.Text = string.Join(" ", "Hello", result.name, "!");
                    }
                    else
                    {
                        this.infoTextBlock.Text = "Error getting name.";
                    }
                }
            }
            catch (LiveAuthException exception)
            {
                this.infoTextBlock.Text = "Error signing in: " + exception.Message;
            }
            catch (LiveConnectException exception)
            {
               MessageBox.Show("Error calling API: " + exception.Message);
            }
        }
        catch (LiveAuthException exception)
        {
            this.infoTextBlock.Text = "Error initializing: " + exception.Message;
        }

    }
    else
    {

        client = null;
    }
}

it logs in on my emulator and one of my 2 lumia 620 devices but with the other device it gives me the following Exception **

*> {client_error: Microsoft.Live.LiveConnectException: Exception of type

'Microsoft.Live.LiveConnectException' was thrown. at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at PhoneApp2.MainPage.d__6.MoveNext()}*

**

a3adel
  • 1,223
  • 4
  • 15
  • 26

0 Answers0