Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Here is the scenario:

MVC 3 application runing in AZURE Dev enviroment Authentication in AZURE ACS implemented the same way found here http://msdn.microsoft.com/en-us/library/hh127794.aspx

I am trying to get the users name, and email, but I can't find a way to configure the "Claim Rule", in a way that I would get a clear text value, instead I get a string that seems to be encrypted. So can I configure the rule in a way that I get it in clear text? Or can I unencrypt the value returned? Is any of this possible or am I looking at the wrong thing here.

Thanks

like image 986
Oakcool Avatar asked Oct 24 '11 06:10

Oakcool


3 Answers

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.

like image 120
dunnry Avatar answered Oct 25 '22 02:10

dunnry


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.

like image 21
Greg Avatar answered Oct 25 '22 02:10

Greg


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.

like image 21
Nariman Avatar answered Oct 25 '22 01:10

Nariman