1

I am not able to get user public_profile info and email in Facebook module. Facebook module Version 4.0.5 Titanium sdk 4.1.0 I have followed all steps described on documentation. Appcelerator Documentation

But only able to get name and id. Although i am able to get email and public_profile information in iOS using FB module 4.0.5. But not succeeded in Android. Is something changed recently or i am doing it in wrong way. These permissions i am using:

fb.permissions = ['public_profile', 'email'];

And requesting is through graphAPI.

exports.loginWithFb = function(callback) {
fb.addEventListener('login', function(e) {
if (e.success) {
Ti.API.error('from facebook success');
fb.requestWithGraphPath("me", {}, 'GET', function(e) {
Ti.API.error("from info success: " + JSON.stringify(e.result));
var data = JSON.parse(e.result);
callback(data);
});
} else if (e.error) {
Ti.API.error('error in fb login: ' + JSON.stringify(e.error));
callback(e);
} else if (e.cancelled) {
Ti.API.error('login cancelled: ' + JSON.stringify(e.error));
callback(e);
}
});
fb.authorize();
};

And for iOS i used graph API in this way.

    fb.requestWithGraphPath("me?fields=name,email,first_name,last_name", {}, 'GET', function(e) {
Ti.API.error("from info success: " + JSON.stringify(e.result));
var data = JSON.parse(e.result);
callback(data);
});

But same graph API call not executing for Android. Throwing exception of undefined token.

  • https://stackoverflow.com/questions/37882708/error-2500-when-trying-to-get-facebook-email-in-appcelerator-titanium – Andrew Jul 13 '17 at 17:46

1 Answers1

0

Did you remember to add the file: /platform/android/res/values/strings.xml? With content similar to:

<resources>
    <string name="facebook_app_id">FACEBOOK_APP_ID</string>
</resources>

I am also working with this module at the moment - though just trying to share... So not exactly the same situation :-)

One other thing that I have seen while looking for solutions to my own challenge is that it seems you need to provide the Facebook "appid" before you try to call ".authorize()". Something like this:

fb_s.appid = YOUR_FB_APP_ID;
fb_s.permissions = ['...'];

fb_s.authorize();

/John

John Dalsgaard
  • 2,797
  • 1
  • 14
  • 26