user879381
user879381

Reputation: 11

(Facebook C# SDK) FacebookWebContext.Current.IsAuthenticated always return false

Hi guys im using the facebook c# sdk 5.0.50 to get the email and name of a facebook account in a web application but the FacebookWebContext.Current.IsAuthenticated always return false and the fbWebContext.UserId is always 0 (zero) even if im logged in facebook.

I already configured my web.config with my AppId and my AppSecret. I also copied the Facebook.dll and the Facebook.Web.dll to my Bin folder. Im using the Facebook Javascript SDK to do the logging part. Is there something im missing?

Here is my code

The logging Part:

FB.login(function (response) {
    if (response.authResponse) {

        FB.api('/me', function (response) {
            console.log('Good to see you, ' + response.name + '.');                               
            window.location.reload();
        });
   } else {
        console.log('User cancelled login or did not fully authorize.');
   }
}, { scope: 'email,user_birthday' });

And in the code behind Im using the following code:

If fbWebContext.IsAuthenticated Then
   Dim fb = New FacebookWebClient(fbWebContext)

   Dim meInfo = CType(fb.Get("me"), Dictionary(Of String, Object))
   Dim firstName As String = meInfo("first_name")
   Dim lastName As String = meInfo("last_name")
   Dim email As String = meInfo("email")

   Mensaje.Text = String.Concat("code: ", firstName)
Else
   Mensaje.Text = "not authorized - " & fbWebContext.Settings.AppId & " -" & fbWebContext.Settings.AppSecret
End If

I can display the info using the Facebook Javascript SDK but i need to do this in the server because after i get the user i need process it to see if he is in our database

Please some help Thanks in advance

Upvotes: 1

Views: 1063

Answers (1)

DMCS
DMCS

Reputation: 31880

Looks like it was a bug with the framework (see http://facebooksdk.codeplex.com/workitem/5893) You should get the latest version, the fix is in it.

Upvotes: 1

Related Questions