问题描述
使用 Windows 8 Live SDK,您可以让用户授予您访问其 Microsoft 帐户的权限.有了这个,你可以得到他们的名字和照片等等.但使用 Live SDK 似乎要求应用用户使用与登录到当前 Windows 8 会话的用户相同的 Microsoft 帐户.
在某些情况下,使用不同的帐户是非常合法的.
我的登录功能非常简单!这使用相同的帐户.
我找不到使用其他方法的方法.有可能吗?
可以在Init之后,LoginUser之前调用Logout.
这是javascript的代码:
函数 LiveLogin(){WL.init("<<你的客户端ID在这里>>");如果(WL.canLogout()){WL.logout(function () {Callback(callback);});}别的{回调(回调);}}函数回调(){WL.login({ 范围: ["wl.signin", "wl.basic", "wl.emails"] }, function () {var session = WL.getSession();//对你的会话做一些事情});}
这是针对 C# 的:
LiveAuthClient liveAuthClient = new LiveAuthClient();列表<字符串>范围=新列表<字符串>();scopes.Add("wl.signin");scopes.Add("wl.basic");scopes.Add("wl.emails");LiveLoginResult loginResult = 等待 liveAuthClient.InitializeAsync();如果(liveAuthClient.CanLogout){liveAuthClient.Logout();}loginResult = 等待 liveAuthClient.LoginAsync(scopes);
它对我有用.我希望这就是您正在寻找的.p>
Using the Windows 8 Live SDK you can have a user give you permission to their Microsoft Account. With this you can get their name and photo and more. But using the Live SDK appears to require the user of the app to use the same Microsoft Account as whoever is signed into the current session of Windows 8.
In some scenarios, using a different account is very legitimate.
I have simple sign-in working like a charm! This uses the same account.
I can't find a way to do use another. Is it possible?
You can call Logout after Init and before LoginUser.
Here's the code for 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
});
}
And this is for 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);
It worked for me.I hope this is what you are looking for.
这篇关于Windows 8 Live SDK 可以使用当前用户以外的其他 Microsoft 帐户吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!