1

Is it possible to get the user's Microsoft Account programmatically, even if it prompts the user to allow the app to know about it?

I'm trying to make sure that I get the user's real Microsoft Account, rather than just letting them enter any email address in a textbox. If they don't want to give it, that's completely fine and they can continue using the app without using this scenario.

I found various references that said that the apps are isolated from getting it automatically, which makes sense as a privacy thing. I just wanted to see if anyone knew of a way to get it "sort of" automatically with the user granting permission or anything like that.

I guess one alternative would be to use the Live SDK and have them "log in" to the app. But that seems like overkill for this scenario and may not even work (I think that even just gives a "unique id" not the actual Microsoft Account address).

Tim
  • 14,999
  • 1
  • 45
  • 68
  • As I remember there is no option to LogIn in LiveSdk under Windows 8. User always logged in(if user account is ms account). – crea7or Jun 08 '15 at 20:37
  • [Here](http://stackoverflow.com/questions/19740975/get-microsoft-account-id-from-windows-8-desktop-application) is a similar question for Windows 8 Desktop. Not sure if it will help you with WinRt though. – Icemanind Jun 09 '15 at 16:27
  • @Icemanind yeah, unfortunately you don't have access to those things through Winrt. Thanks though! – Tim Jun 09 '15 at 16:33
  • What is the account name for? Are you trying to roam some kinds of application state? – Sheng Jiang 蒋晟 Jun 09 '15 at 17:00
  • It's to tie in the application with some features and data on our website that they would also be using. We wanted to try to tie them together without having to ask the user to enter their email address into the app (in all cases, they'd be using their Microsoft Account address on the website). – Tim Jun 09 '15 at 17:19
  • You can safely assume that there isn't a user in the wide world that's going to be comfortable with his account name residing on an unknown web server without his knowledge used for who-knows-what. If you need it then you are going to have to ask him for it. Don't bother, you won't get it. Do review the privacy requirements you need to meet to get your app certified, if you think this is a good idea then you are bound to overlook a lot more details. – Hans Passant Jun 09 '15 at 17:34
  • @HansPassant - That's a little backwards for the scenario. It would already exist on the webserver and would only be there if the user put it there; though I recognize that the restriction is there so that it couldn't be "farmed" to be put out in the wild. But, as I said in the question, I am perfectly fine asking for permission to get the value. I just want to ensure that it is the actual account and not some random address they typed in. User would have full control of whether the app gets it or not. I don't want to circumvent that. – Tim Jun 09 '15 at 17:38
  • That's chicken-and-egg, it can't exist on your web server until you have an account name. You can't get it. This is a classic XY question btw, you assume the Microsoft account name would be the solution, it just isn't. – Hans Passant Jun 09 '15 at 17:42
  • @HansPassant Think about it like the location information. Of course the app shouldn't just be able to get the user's location. But you request it and the user can agree or disagree and if they agree then you have some expectation its the real value. – Tim Jun 09 '15 at 17:42
  • @HansPassant they have a separate interaction with the website. I'll admit, I'm trying to simplify the scenario and probably confusing it. But basically they would interact with the website one day, entering their address. Then if they run the app on some later day, we could connect the app with what they entered. Sort of a slimmed down version of using Microsoft Auth on both ends, I guess. We can do something more complicated like that (and we may end up doing it), but we're trying to make it easy for the users. – Tim Jun 09 '15 at 17:45

0 Answers0