2012-12-18 68 views
1

我正在使用SkyDrive创建一个WP7应用程序访问它。我正在使用SkyDrive API。当我尝试登录时,它显示'Inalid Request'错误。任何人都可以告诉我我的代码有什么问题吗?登录SkyDrive API for Windows Phone应用程序的问题

private void login_Click() 
    { 
     LiveAuthClient auth = new LiveAuthClient("signInButton1.ClientId"); 
     auth.LoginCompleted += 
     new EventHandler<LoginCompletedEventArgs>(MoreScopes_LoginCompleted); 
     auth.LoginAsync(new string[] { "wl.signin", "wl.basic", "wl.skydrive", "wl.skydrive_update " }); 
    } 

    void MoreScopes_LoginCompleted(object sender, LoginCompletedEventArgs e) 
    { 

     if (e.Status == LiveConnectSessionStatus.Connected) 
     { 
      LiveConnectSession session = e.Session; 
      LiveConnectClient client = new LiveConnectClient(session); 
      infoTextBlock.Text = "Signed in."; 
     } 
     else if (e.Error != null) 
     { 
      infoTextBlock.Text = "Error signing in: " + e.Error.ToString(); 
     } 
    } 

    private void signInButton1_SessionChanged(object sender, Microsoft.Live.Controls.LiveConnectSessionChangedEventArgs e) 
    { 
     login_Click(); 

    } 

回答

0
 
Check this: 

    LiveAuthClient auth = new LiveAuthClient("signInButton1.ClientId"); 

it should be: 

    LiveAuthClient auth = new LiveAuthClient(signInButton1.ClientId); 

相关问题