hello.js icon indicating copy to clipboard operation
hello.js copied to clipboard

Facebook email is not returning in me api

Open mzahidriaz opened this issue 8 years ago • 6 comments

I've tried so many different ways

e.g.

var facebook = hello('facebook');
facebook.login({
    scope: 'email,user_friend',
    force: true
}).then(function() {
    return facebook.api('me/permissions');
}).then(function(r) {
    if (r.data.filter(function(item) {
        return item.permission === 'email' && item.status !== 'granted'
    }).length) {
        throw new Error('missing permissions');
    }
    else {
        return facebook.api('me');
    }
}).then(successShowEmail, errorShowLoginButton);
hello.login(network, { scope: 'email' })

But I am not able to receive email from hello.js

mzahidriaz avatar Apr 05 '16 05:04 mzahidriaz

Perhaps its a app level permission thing. Do you get it when using the demo at https://adodson.com/hello.js/?

MrSwitch avatar Apr 15 '16 17:04 MrSwitch

Hello

I have the same issue with the hello.js on a new domain and app. On a older app and domain it is working as expected...

Older App ( & old domain ):

array (
  'id' => '...',
  'birthday' => '...',
  'email' => '...',
  'first_name' => '...',
  'gender' => '...',
  'last_name' => '...',
  'link' => '...',
  'locale' => '...',
  'name' => '...',
  'timezone' => 1,
  'updated_time' => '...',
  'verified' => true,
  'picture' => '...',
  'thumbnail' => '...',
)

New App & Hello.js page ( & new domain ):

array (
  'name' => '...',
  'id' => '...',
  'picture' => '...',
  'thumbnail' => '...',
)

Can't figure this out...

jarodium avatar May 06 '16 09:05 jarodium

Perhaps define the fields property?

hello('facebook').api('me', {fields: 'email,name,id'}).then(successHandler)

MrSwitch avatar May 06 '16 11:05 MrSwitch

That worked ( using me?fields=xxxx ). But on the older app ( same api version ) worked without requesting fields -.-

Facebook giving special treatment to older apps is less likely the reason the older app is working -.- But that is just my rant...

Thank you for the time @MrSwitch

jarodium avatar May 06 '16 18:05 jarodium

Same issue here now. My old app from 2016 works fine on getting an email from facebook and google, now I can't get it anymore. Made the suggested trick by MrSwitch, but no success. Any help?

hello.on('auth.login', function(r) {
  // Get Profile

  hello( r.network ).api( '/me', {fields: 'email,name,id'} ).then( function(p) {

    console.log("got in: " + JSON.stringify(p, true, 2));

    user_name = p.name;
    user_email = p.email;
    user_profile_pic = p.thumbnail;
    user_network = r.network;
    user_kind = p.kind;
    user_gender = p.gender;
    user_url = p.url;
    user_last_name = p.last_name;
    user_first_name = p.first_name;
    user_id = p.id;
    user_display_name = p.displayName;

  if (typeof(chrome) === 'object') {
    img_xhr(label.getElementsByTagName('img')[0], p.thumbnail);
  }

});
});

// Intiate App credentials
hello.init({
  google : CLIENT_IDS_ALL.google,
  facebook : CLIENT_IDS_ALL.facebook
},{
  scope : ['friends','email'],
  force : true,
  redirect_uri: REDIRECT_URI,
  oauth_proxy: OAUTH_PROXY_URL
});


richardh8 avatar Jul 17 '17 06:07 richardh8

only with scope: ['email'] in hello.init () is enough, you can omit the fields in ....api ('me', {fields: 'email, name, id'})... it has worked for me (Google), I have not tried for facebook

braian125 avatar Dec 13 '18 04:12 braian125