Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

facebook fbml login-button not working with perms

I recently ran into a problem when I upgraded to the new php and js sdk

before the login button below worked fine, and the dialog box popped up for a user to grant permission.

<fb:login-button perms="email,user_about_me,user_interests,user_location,publish_stream,read_stream,offline_access,publish_checkins">Connect Facebooks</fb:login-button>

Now the dialog won't pop up, but if I take out the "perms" and use this button

<fb:login-button">Connect Facebook</fb:login-button>

the dialog does pop up. any ideas?

like image 868
Clint C. Avatar asked Aug 10 '11 22:08

Clint C.


1 Answers

Update: The bug causing this issue was resolved, so your best option is to use <fb:login-button> still, but change "perms" to "scope" to match the latest API changes:

<fb:login-button
    scope="email, user_about_me, user_interests, user_location,
    publish_stream, read_stream, offline_access, publish_checkins">
    Connect Facebooks
</fb:login-button>

If you're still seeing issues after that or want an alternative login button style: there's actually nothing very special about <fb:login-button>, it's just an easy way to render a login button, which is (mostly) a thing that calls FB.login() when clicked. You can make your own login button with just a little bit more work by doing something like:

<a id="fb_login_button" href="#" 
      onclick="FB.login(function(){ /* this is a callback function */ },
      {scope: 'email, user_about_me, user_interests, user_location,
       publish_stream, read_stream, offline_access, publish_checkins'});
       return false;">
    <img src="LOGIN_BUTTON_IMAGE.png" alt="Log In with Facebook">
</a>

Where the login button image is any image or text (you could even use a screenshot of the one rendered by <fb:login-button>).

(note: inline onclick used here so this is library-independent, not implying it's a good practice to do so)

like image 130
Ben Regenspan Avatar answered Nov 07 '22 09:11

Ben Regenspan