0

I'm building a Facebook Page Tab app using ASP.NET MVC.

I've setup the mobile redirect using the answer from this post about How to create a mobile accessible Facebook Page Tab app.

I am now trying to add Facebook login functionality as follows

$('#button-login').on('click', function (e) {
  e.preventDefault();

  FB.login(function (response) {
    if (response.status === 'connected') {
      // the user is logged in and has authenticated your app
      var userId = response.authResponse.userID;
      var accessToken = response.authResponse.accessToken;

      $('<form>', {
        'action': '/login',
        'method': 'post',
        'html': '<input type="hidden" name="accessToken" value="' + accessToken + '" />'
      }).appendTo(document.body).submit();
    } else if (response.status === 'not_authorized') {
      // ths user is logged into Facebook, but has not authenticated your app
    } else {
      // the user isn't logged into Facebook
    }
  }, { scope: 'public_profile, email' });
});

This works fine on desktop. When attempting to login on mobile I end up getting a Facebook error page with the following message

Sorry, this feature isn't available right now: An error occurred while processing this request. Please try again later.

Any ideas about what workarounds are available?

Community
  • 1
  • 1
Sean Dooley
  • 615
  • 2
  • 11
  • 27

1 Answers1

0

I don´t see any redirection code in there, but i assume you try to redirect to the Page URL (www.facebook.com/yourpage?app_xxxxx) - it does not work on mobile, so you have to redirect to the source of the iframe on mobile. Meaning, the URL you put in the Page Tab platform in your App settings.

One way to do a mobile detection: http://mobiledetect.net/

andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • The initial redirect is handled as described in the link 'How to create a mobile accessible Facebook Page Tab app'. The question revolves around the FB.login issue on mobile. Maybe I need to change the post title. – Sean Dooley Nov 21 '14 at 10:51
  • Unable to provide a link at the moment due to client confidentiality. If I get time I'll try to setup a test link. – Sean Dooley Nov 21 '14 at 11:07