locked
Single Sign-On

    Question

  • I am trying to make an app which allows someone to sign into windows 8 with their MS account, they get the basic yes/no access dialog, then I get some value I can use to know which user it's signed in to that PC, this will allow me to sync data to my server with that value, then once the user uses another pc with the same MS account, sync the info there too...

    I tried with the following kind of code...

    Dim a As New Windows.Security.Authentication.OnlineId.OnlineIdAuthenticator
    Dim b As New Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest("wl.signin", "DELEGATION")
    Dim c As Windows.Security.Authentication.OnlineId.UserIdentity = Await a.AuthenticateUserAsync(b)
    Dim d As New Windows.UI.Popups.MessageDialog(c.Id)

    However when I try to grab the id, it keeps popping up the following message...

    Your application cannot get the Online Id properties due to the Terms of Use accepted by the user.

    What should I be doing here instead?  I got the dialog I want to popup, but I need a unique ID so I know what data to sync as they move across pc's logged into the same MS account.


    • Edited by Maya Key Tuesday, April 08, 2014 3:12 AM
    Tuesday, April 08, 2014 3:10 AM

Answers

  • @Matt Small, I think to make that code work I had to associate the app to the store.

    Anyways, I figured out how to do it properly with minimal code after making such an association in the store.

    Dim a As New Microsoft.Live.LiveAuthClient
    Dim b As Microsoft.Live.LiveLoginResult = Await a.LoginAsync({"wl.signin"})
    If b.Status = Microsoft.Live.LiveConnectSessionStatus.Connected Then
        Dim c As New Microsoft.Live.LiveConnectClient(b.Session)
        Dim d As Microsoft.Live.LiveOperationResult = Await c.GetAsync("me")
    Else
        Dim c As New Windows.UI.Popups.MessageDialog("You need to allow access to sign in to your microsoft account so that this app will work fully.")
        Await c.ShowAsync
    End If

    And having that placed into an async sub.



    • Edited by Maya Key Wednesday, April 09, 2014 4:51 AM
    • Marked as answer by Maya Key Wednesday, April 09, 2014 2:23 PM
    Wednesday, April 09, 2014 4:49 AM

All replies

  • Hi Michael - this question may be better answered on the Live forums.  However, I did try to run your code but I'm clearly missing a capability or something, since I keep getting this message:

    The application requesting authentication tokens is either disabled or incorrectly configured


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, April 08, 2014 7:27 PM
    Moderator
  • @Matt Small, I think to make that code work I had to associate the app to the store.

    Anyways, I figured out how to do it properly with minimal code after making such an association in the store.

    Dim a As New Microsoft.Live.LiveAuthClient
    Dim b As Microsoft.Live.LiveLoginResult = Await a.LoginAsync({"wl.signin"})
    If b.Status = Microsoft.Live.LiveConnectSessionStatus.Connected Then
        Dim c As New Microsoft.Live.LiveConnectClient(b.Session)
        Dim d As Microsoft.Live.LiveOperationResult = Await c.GetAsync("me")
    Else
        Dim c As New Windows.UI.Popups.MessageDialog("You need to allow access to sign in to your microsoft account so that this app will work fully.")
        Await c.ShowAsync
    End If

    And having that placed into an async sub.



    • Edited by Maya Key Wednesday, April 09, 2014 4:51 AM
    • Marked as answer by Maya Key Wednesday, April 09, 2014 2:23 PM
    Wednesday, April 09, 2014 4:49 AM