Get facebook user email and username / last name using Phonegap FB Plugin for iOS app

Work with my first ios mobile app. Trying to enable this plugin https://github.com/Wizcorp/phonegap-facebook-plugin/tree/master/platforms/ios/www

Basically, I just need to notify users about how to do this with this plugin.

What I wanted to do was get this information, and then pre-fill some forms to create a new user to use with Parse.

I can get a response from this function, which displays the status and authResponse with tokens and user ID:

var login = function () { if (!window.cordova) { var appId = prompt("Enter FB Application ID", ""); facebookConnectPlugin.browserInit(appId); } facebookConnectPlugin.login( ["email"], function (response) { alert(JSON.stringify(response)) }, function (response) { alert(JSON.stringify(response)) }); } 

I'm just not sure about the next steps in finding users email and name / s ... and even if I have to dig deeper into the facebooks API.

any help is appreciated.

* UPDATED *

Figured it out. I missed the step that I found on the facebook api page

  var login = function() { if (!window.cordova) { facebookConnectPlugin.browserInit('APPID'); facebookConnectPlugin.browserInit(appId); } facebookConnectPlugin.login(["email"], function(response) { if (response.authResponse) { facebookConnectPlugin.api('/me', null, function(response) { alert('Good to see you, ' + response.email + response.name + '.'); }); } }); } 
+7
javascript ios facebook cordova
source share
1 answer

Try this plugin ( http://plugins.cordova.io/#/package/com.ccsoft.plugin.cordovafacebook ) that covers all your needs.

0
source share

All Articles