jquery-fblogin icon indicating copy to clipboard operation
jquery-fblogin copied to clipboard

Only id and name is getting returned

Open shahakshay94 opened this issue 8 years ago • 2 comments

$.fblogin({
            fbId: 'xxxxxx',
            permissions: 'email,user_birthday',
            success: function (data) {
                console.log('Basic public user data returned by Facebook', data);
               // $.jStorage.set('name',data.name)
                //window.location.href = 'index.html';
            },
            error: function (error) {
                console.log('An error occurred.', error);
            }
        });

I am only getting id and name though I have added the additional permissions.

shahakshay94 avatar Dec 21 '16 07:12 shahakshay94

Unfortunately I haven't dealt with the Facebook API in years and haven't published an update to this plugin during that time.

I will try to have a look at this when I get some time, but if you are in need of an immediate fix I'd recommend maybe looking into the issue yourself.

More than likely Facebook has made some changes to their API that have resulted in the plugin breaking.

Sent from my iPhone

On Dec 21, 2016, at 2:01 AM, Akshay Shah [email protected] wrote:

$.fblogin({ fbId: 'xxxxxx', permissions: 'email,user_birthday', success: function (data) { console.log('Basic public user data returned by Facebook', data); // $.jStorage.set('name',data.name) //window.location.href = 'index.html'; }, error: function (error) { console.log('An error occurred.', error); } }); I am only getting id and name though I have added the additional permissions.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

ryandrewjohnson avatar Dec 21 '16 13:12 ryandrewjohnson

This plugin still works great with two changes: a very minor change to the plugin code to update the Facebook API version, & you specify additional parameters when you call fblogin().

  1. In the "initFB" section, change version: 'v2.0' to v2.12 instead. Facebook is deprecating old API versions. The last Facebook API version that returned the default user fields the OP was expecting was v2.3 which is no longer available.

  2. For all current Facebook API versions, explicitly define the API permissions AND fields you want returned. So as an example (not specific to the question above) where you call $.fblogin, you'd specify something like:

$.fblogin({
	fbId:'.........................',
	permissions:'public_profile,email',
	fields:'email,first_name,last_name,gender',
	.....

This plugin supports all the necessary parameters to work with API v2.12. You just have to follow the current Facebook API versions' requirements & specify all the necessary permissions & fields you want back.

At the moment the lowest version API still supported by Facebook is v2.5, & the minimum version will switch to v2.6 in a few weeks (on 4/12/18). However API v2.12 is the latest version & good through Jan 2020 so you might as well use that... Hope this helps someone!

autobeef avatar Mar 29 '18 18:03 autobeef