为什么Live Connect SignInButton失败并且redirect_uri无效?

Mat*_*hew 1 .net c# liveconnect live-connect-sdk windows-phone-8

我正在尝试Windows Phone应用和实时连接.我的主页上有这个控件:

xmlns:live="clr-namespace:Microsoft.Live.Controls;assembly=Microsoft.Live.Controls"

...

<live:SignInButton ClientId="[my client id, which I registered earlier today]"
                   Scopes="wl.signin wl.basic"
                   Branding="Skydrive"
                   TextType="SignIn"
                   SessionChanged="SignInButton_SessionChanged" />
Run Code Online (Sandbox Code Playgroud)

这是处理程序SessionChanged:

private async void SignInButton_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e)
{
    if (e.Error != null)
        System.Diagnostics.Debugger.Break();

    ...
}
Run Code Online (Sandbox Code Playgroud)

我使用Windows Phone模拟器调试我的应用程序.单击"登录"按钮时,出现此异常:

输入参数'redirect_uri'的提供值无效.客户端应用程序必须标记为"mobile",或者值必须是与注册的重定向URI匹配的绝对URL.

我没有明确指定redirect_uri任何地方.为什么登录因无效而失败redirect_uri

Mat*_*hew 8

您必须在Windows应用商店开发人员中心明确地将您的应用标记为"移动".

  1. 在浏览器中打开https://account.live.com/developers/applications/.
  2. 从"我的应用"中选择您的应用
  3. 单击"编辑设置"链接
  4. 单击"API设置"链接.
  5. 将"移动或桌面客户端应用程序"设置为"是".

API设置页面截图