locked
Login to WebApi (MVC + WebApi) with Microsoft Account from Windows Store App

    Question

  • Hi

    How can I access a WebApi Controller (ASP.NET MVC+WebApi) that is secured with Microsoft Account from a Windows Store App?

    I have no idea how to login. I tried the LiveSDK but this gives me only access to OneDrive, Callender and so on.

    Could someone please point me in the right direction.

    Thanks

    Guenter

    Monday, March 09, 2015 4:47 PM

Answers

  • Hi Gunter,

    I think I did not understand the concept of LiveID and how I can use it in an Universal App to Login to my Web API backend.

    -> I believe this is a good start for you: Requirements for Microsoft account sign-in, you do not need to show the Web browser to navigate to the login page, you can integrate this feature with the app.

    I'm not sure what kind of functionality you would like to implement in your app, but the tutorial I provided is to sign in the Live account in the app, if you still have other functionality on the backend Web API, probably you want to ask question at Web API forum for a better support.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 16, 2015 3:02 AM
    Moderator

All replies

  • Hi Gunter,

    Not quite understand what do you mean by secured with Microsoft Account, if you mean Hotmail or Outlook account, LiveSDK is the correct thing you need to work with. For more information you may check Windows Live Services

    Or do you mean by some other Microsoft account?

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 10, 2015 2:09 AM
    Moderator
  • Hi James,

    thank you for your answer.

    Yes, I mean LiveID and I am using LiveSDK in the App to signin the user. But what is the next step to access the REST WebAPI Controller?
    I thought this is common scenario and I could use the Access Token returned by the LiveAuthClient LoginAsync call to access my REST service.

    I could not found a tuturial for this. Am I on the wrong way?

    Thanks

    Guenter

    Tuesday, March 10, 2015 9:11 AM
  • Hi Guenter,

    To be clear, you are using Microsoft account as login and at same time you have your own REST service for other functionalities?

    Let's say if you login with LiveSDk, you should be able to get some access token, see this for more information: Signing users in, after that use the token to access your REST service, as I understand REST service is a kind of http request, we can use HTTPClient to request data from the address.

    I'm afraid there is no existing sample here but the only thing I found is HTTPClient sample: https://code.msdn.microsoft.com/windowsapps/HttpClient-sample-55700664, you can use POST to send your token information to the server.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, March 11, 2015 1:42 AM
    Moderator
  • Hi James,

    thanks again. I think I did not understand the concept of LiveID and how I can use it in an Universal App to Login to my Web API backend.

    Maybe I have to show the Webbrowser control on startup und navigate to the my login page. I did not know. Without a working tutorial I am lost.

    Thanks

    Guenter

    Thursday, March 12, 2015 12:39 PM
  • Hi Gunter,

    I think I did not understand the concept of LiveID and how I can use it in an Universal App to Login to my Web API backend.

    -> I believe this is a good start for you: Requirements for Microsoft account sign-in, you do not need to show the Web browser to navigate to the login page, you can integrate this feature with the app.

    I'm not sure what kind of functionality you would like to implement in your app, but the tutorial I provided is to sign in the Live account in the app, if you still have other functionality on the backend Web API, probably you want to ask question at Web API forum for a better support.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 16, 2015 3:02 AM
    Moderator