1

我正在创建一个带有 SkyDrive 访问权限的 WP7 应用程序。我正在使用 SkyDrive API。当我尝试登录时,它显示“无效请求”错误。谁能告诉我我的代码有什么问题?

    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();

    }
4

1 回答 1

0
检查这个:

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

它应该是:

    LiveAuthClient auth = new LiveAuthClient(signInButton1.ClientId);

于 2013-10-30T07:45:24.597 回答