【问题标题】:Can the Windows 8 Live SDK use another Microsoft Account other than the current user?Windows 8 Live SDK 可以使用当前用户以外的其他 Microsoft 帐户吗?
【发布时间】:2012-12-13 22:56:44
【问题描述】:

使用 Windows 8 Live SDK,您可以让用户授予您访问其 Microsoft 帐户的权限。有了这个,你可以得到他们的名字和照片等等。但使用 Live SDK 似乎要求应用用户使用与登录到当前 Windows 8 会话的用户相同的 Microsoft 帐户。

在某些情况下,使用不同的帐户是非常合法的。

我的登录功能非常简单!这使用相同的帐户。

我找不到使用其他方法的方法。有可能吗?

【问题讨论】:

    标签: windows-8 live


    【解决方案1】:

    您可以在 Init 之后和 LoginUser 之前调用 Logout。

    这是javascript的代码:

    function LiveLogin(){
       WL.init("<<Your clientID goes here>>");
    
       if (WL.canLogout()) {
           WL.logout(function () {Callback(callback);});
       }
       else{
           Callback(callback);
       }
    }
    
    function Callback(){
    WL.login({ scope: ["wl.signin", "wl.basic", "wl.emails"] }, function () {
            var session = WL.getSession();
            // do stuff with your session
        });
    }
    

    这是针对 C# 的:

    LiveAuthClient liveAuthClient = new LiveAuthClient();
    List<string> scopes = new List<string>();
    scopes.Add("wl.signin");
    scopes.Add("wl.basic");
    scopes.Add("wl.emails");
    LiveLoginResult loginResult = await liveAuthClient.InitializeAsync();
    if (liveAuthClient.CanLogout)
    {
        liveAuthClient.Logout();
    }
    
    loginResult = await liveAuthClient.LoginAsync(scopes);
    

    它对我有用。 我希望这就是您正在寻找的。​​p>

    【讨论】:

      猜你喜欢
      • 2017-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多