locked
Silverlight "livedatacontext.signinasync()" method RRS feed

  • Question

  • Hi,

    Sorry to bother. I have a simple test Silverlight project that uses an access token and refresh token passed to it from an ASP.net app. All works fine if I use live datacontext.signin method in ASP.net but not in silverlight. Any ideas. Could it be that the access token is specific to an ASP.net app.

    Private Sub Application_Startup(ByVal o As Object, ByVal e As StartupEventArgs) Handles Me.Startup
        Me.RootVisual = New MainPage()
    
        Dim initParams As New Dictionary(Of String, String)
        initParams = e.InitParams
        Dim clientId As String = initParams.Item("clientId")
        Dim secretKey As String = initParams.Item("secretKey")
        Dim accessToken As String = initParams.Item("accessToken")
        Dim refreshToken As String = initParams.Item("refreshToken")
    
        Dim appAuth As New AppAuthentication(accessToken, refreshToken)
        Dim appInfo As New AppInformation(clientId, secretKey, appAuth)
    
        Dim offerRequest As New Microsoft.Live.Offer
        offerRequest.Action = "View"
        offerRequest.Name = "WL_Photos"
        appInfo.RequestedOffers.Clear()
        appInfo.RequestedOffers.Add(offerRequest)
    
        liveContext.SignInAsync(appInfo, Nothing)
    
        Do While signInSuccess = False
          Thread.Sleep(500)
        Loop
    
        liveAlbumsCollection = liveContext.GetAlbumsCollection
        liveAlbumsCollection.LoadAsync(liveContext.AlbumsQuery)
    
      End Sub
      
      Public Sub SignInCompletedEventHandler(ByVal sender As Object, ByVal e As SignInCompletedEventArgs) Handles liveContext.SignInCompleted
        signInSuccess = True
      End Sub
    Sunday, September 26, 2010 10:47 PM

Answers

All replies

  • Hi Paul, what error message are you getting when you try to run this?
    Friday, October 1, 2010 4:35 PM
    Moderator
  • Hi,

    I get nothing. After posting I noticed you are withdrawing the .NET API so I have been trying to use direct REST calls from a silverlight app. Again I get absolutely no response from the async calls using HTTPWebRequest or Webclient objects. No errors either. I get no responses at any level from service discovery to resourse entries.

    The same code works fine on the ASP server side but not in silverlight.

    I now wonder if this is a cross domain security issue. Do I need a security certificate or something.

    Cheers Paul

    Tuesday, October 5, 2010 10:01 PM
  • Please install Fiddler to inspect whether the HTTP request actually happens on the wire.
    Friday, October 8, 2010 9:16 AM
  • Fine on server code. But fiddler shows no requests are made from silverlight code. why??
    Monday, October 11, 2010 6:02 PM
  • Hi Paul, are you using the Messenger Connect .NET library which was discontinued?

    thx

    Angus


    Angus Logan | Technical Product Manager | Windows Live Platform | http://blogs.msdn.com/angus_logan
    Tuesday, October 19, 2010 2:59 AM
  • Hi Paul -- for making REST calls from a SL application, have you tried the sample here?

    http://code.msdn.microsoft.com/messengerconnect/Release/ProjectReleases.aspx?ReleaseId=5065

    Thursday, November 4, 2010 9:53 PM
    Moderator
  • Hello,

    I'm trying to use the sample project form the link you mentioned.

    It runs fine, but when I click on the "sign In" button, a new windows is shown with the proper Windows Live Header, but with an error message saying something about acess denied.

    I have properly change the client ID and secret key with the one I just created from my own application. when I close the log in screen that is pop up, the following is returned back:

    Failed to grant consent to the application to permit access to user's data in Windows Live.
       em Microsoft.MessengerConnectHelper.MessengerConnectSigninContext.GetToken(AppInformation applicationInfo) na C:\Users\XXXX\Desktop\Desktop_App_Sample\MessengerConnectAuthHelper\FullCLR\MessengerConnectSignInContextFullCLR.cs:linha 107
       em WindowsFormsApplication1.SignInTester.SigninSynchronous() na C:\Users\ikondrasovas\Desktop\Desktop_App_Sample\AuthTest\SigninTester.cs:linha 53
       em WindowsFormsApplication1.SignInTester.button1_Click(Object sender, EventArgs e) na C:\Users\XXXX\Desktop\Desktop_App_Sample\AuthTest\SigninTester.cs:linha 36

    How can I try down this problem. I have also tested the Silverlight version of this project, but the error is the same.

    Igor.


    Software Developer for Business Applications www.twitter.com/ikondrasovas
    Tuesday, December 21, 2010 1:27 AM