How do I get the user's email when using Microsoft Account Authentication in a MVC project? RRS feed

  • Question

  • I have modified startup.Auth.cs. Here is what I have:

    MicrosoftAccountAuthenticationOptions mo = new 
                ClientId = "My Client ID",
                ClientSecret = "My Client Secret",
    This allows me to authenticate the user.

    I have tried adding the scopes wl.signin, wl.emails and wl.contacts_emails. However, they cause the Microsoft login page to report the following error: AADSTS70011: The provided value for the input parameter 'scope' is not valid. The scope wl.signin, wl.emails, wl.contacts_emails is not valid. The scope combination of openid and email seems to work together. However, the scope openid is overkill for what I am trying to do. That is, I think it is too much to ask from the user. The scope email all by it self doesn't work.

    How do I get only the user's email?

    • Moved by 宝宝徐 Friday, July 28, 2017 2:13 AM
    Tuesday, July 25, 2017 6:25 PM

All replies

  • Hi friend,

    Thanks for you posting.

    This forum is for Visual Studio IDE issues, since your issue is more related to ASP.NET developing, and there is a particular forum for it, please post your issue at the forum below where you could get a quick and professional answer:

    Thanks for your understanding.


    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, July 26, 2017 6:42 AM
  • Ok, I posted it to the forum you suggested. Thanks!
    Wednesday, July 26, 2017 2:35 PM
  • I posted this question to the other forum. What else do I need to do? How can I remove the question from here? What you gave is not a solution to the problem so I don't think I should be marking it as answered. However, it is not clear what i am supossed to do next.
    Thursday, July 27, 2017 12:44 PM