AZURE ACS - Windows Live ID - How do I get the email and name of the authenticated user?

烂漫一生 提交于 2019-11-28 12:19:06
dunnry

IIRC, it is against Windows Live privacy policy to release the user's name or email address as claims (unlike Gmail or Yahoo!). As such, it is not possible to get those claims from Live (unless you happen to be Microsoft).

The only value you can get is called a name identifier. It is unique per RP domain (i.e. it is not a single value per LiveID, but differs by domain). This is also intentional so that you cannot have different websites collaborating to track a user. Typically, you would get the name identifier (called a PUID) and then stick that in your database somewhere so you know that you have seen it before. Then the user registers on your side with name, email, etc. and you correlate that with the PUID.

On the other hand, LiveId also supports OAuth2, so you can get whatever user profile information you need from the user (with his/her consent). See here.

This is a total #FAIL on the part of Microsoft. The users, when logging into your site using Google or other providers, they have to accept first. Then they simply pass the basic information to the site, the site uses it, and everyone is happy.

BTW you can get it from the user with behind-the-scenes code pages but it's not seamless for the user, requires a manual process, but nonetheless the LiveID system is not more secure for doing this, it's simply broken.

Possible but it requires a bit of code for a custom sts:

https://gist.github.com/1867792

Code doesn't build and dependencies aren't included... but it's largely based off an early thinktecture starter site ported to MVC4 with changes shown above.

This blog discusses creating a custom windows live STS provider and then incorporating it as a trusted identity provider in SharePoint.

http://blogs.technet.com/b/speschka/archive/2012/03/01/finally-a-useful-way-to-federate-with-windows-live-and-sharepoint-2010-using-oauth-and-saml.aspx

Unfortunately it seems like the Azure team just don't seem to understand that people may want to actually get something useful back from windows live id.

You can also remove windows live Id as an option for sign on by clicking on it in the Identity providers, and then un-checking the association with your relying party.

(Really weird that you can't choose to delete it =P)

There are a couple of techniques for querying the Live servers for additional information about authenticated users (provided of course that they have given consent). You can do some simple customization to your site using some client side javascript to fetch the information as shown in the example here: http://msdn.microsoft.com/en-us/library/live/hh826534.aspx.

It's also possible, although a bit more involved, to query the Live servers from your server side code. The example application described at http://dominicbetts.github.io/waad-acs-sample/index.html shows one possible approach in an MVC4 application.

There seems to be a way, a bit convoluted, but by becoming the broker and using live connect API, you can achieve this functionality.

Please see: http://code.msdn.microsoft.com/windowsazure/Get-Azure-ACS-work-40d588cc#content

Its possible by iFrame Trick.

<iframe src="https://login.live.com/login.srf?wa=wsignout1.0" frameborder="0"></iframe>

this wont redirect you to MSN page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!