AuthenticationToken为null [英] AuthenticationToken is null
问题描述
我目前正在写一个C#应用程序地铁为Windows 8消费者预览版从我的基于REST的Web服务获取的一些数据。我希望应用程序反对使用Windows Live帐户的当前用户的服务进行身份验证。因此,我加入的Windows Live SDK到我的解决方案,并粘贴在文档下面的代码片段到我的登录视图:
I'm currently writing a C# metro app for the Windows 8 consumer preview which fetches some data from my REST-based web services. I want the app to authenticate against the services using the Windows Live account of the current user. Therefore, I added the Windows Live SDK to my solution and pasted the following snippet from the documentation into my login view:
LiveAuthClient liveClient = new LiveAuthClient();
LiveLoginResult loginResult = await liveClient.Login(new string[] { "wl.signin" });
登录呼叫成功后,我想通过加密的 AuthenticationToken
的 LiveConnectSession
通过SSL到我的web服务应解密标记并阅读它感兴趣的信息(也就是文档建议这样的SSO情景)。但可悲的是,在会议 AuthenticationToken
属性始终是空
。 ?我失去了一些东西在这里。
After the login call has succeeded, I want to pass the encrypted AuthenticationToken
of the LiveConnectSession
via SSL to my webservice which should decrypt the token and read the information it is interested in (that's what the documentation suggests for such a SSO scenario). But sadly, the AuthenticationToken
property of the session is always null
. Am I missing something here?
推荐答案
我遇到了同样的问题,并意识到我有两个问题,与我的配置:
I ran into the same problem and realised I had two issues with my configuration:
- 我没有一个重定向域中的 https://manage.dev.live.com
- 我没有使用重载LiveAuthClient构造
例如在API设置,您指定:
For example in the API settings you specify:
重定向域: HTTP://本地主机/ MyApp的
然后使用LiveAuthClient的构造函数重载:
You then use the constructor overload of the LiveAuthClient:
var authClient = new LiveAuthClient("http://localhost/myapp");
var loginResult = await authClient.LoginAsync("wl-signin");
//this should no longer be null
var authToken = loginResult.Session.AuthenticationToken;
重定向的URI并不需要从我可以告诉指向一个终点的工作,只要因为这两个值匹配,你应该在企业。
The redirect URI doesn't need to point to a working endpoint from what I can tell, as long as the two values match you should be in business.
这篇关于AuthenticationToken为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!