Cordova facebook plugin

Hello,

I have used accounts-facebook for browsers. I have saved additional data of facebook users like profile picture, email etc. Works fine for browsers but doesn’t work for cordova. Which plugin should I add in order to login with facebook and it should share same Collection called users created by accounts-facebook. Any help ?

Thank you!

https://github.com/jeduan/cordova-plugin-facebook4 works for me.

1 Like

Do you use both accounts-facebook and this ? How do you manage to store information in Users collection as accounts-facebook stores.?

I forgot to mention the meteor package:

heysailor:accounts-facebook-cordova

It works properly on android and ios except this bug: https://github.com/jeduan/cordova-plugin-facebook4/issues/165

As a workaround I had to do meteor reset before building the cordova app.

I did meteor reset. And getting these errors.

=> Started proxy.                             
=> Started MongoDB.                           
=> Errors executing Cordova commands:                                              
                                                                                   
   While adding plugin cordova-plugin-facebook4@0.11.0 to Cordova project:         
   Cordova error: Failed to fetch plugin cordova-plugin-facebook4@0.11.0 via registry.
   Probably this is either a connection problem, or plugin spec is incorrect.
   Check your connection and plugin name/version/URL.
   Error: version not found: cordova-plugin-facebook4@0.11.0
   (If the error message contains suggestions for a fix, note that this may not apply to the Meteor
   integration. You can try running again with the --verbose option to help diagnose the issue.)

/root/.meteor/packages/meteor-tool/.1.3.4_1.1l6r4su++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/isopackets/cordova-support/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:165
      throw error;
            ^

Try to edit .meteor/cordova-plugins and replace the version of the fb plugin with cordova-plugin-facebook4@1.7.1

Now this error :

While adding plugin cordova-plugin-facebook4@1.7.1 to Cordova project:
Cordova error: Variable(s) missing (use: --variable APP_ID=value --variable
APP_NAME=value).
(If the error message contains suggestions for a fix, note that this may not
apply to the Meteor integration. You can try running again with the
–verbose option to help diagnose the issue.)

/root/.meteor/packages/meteor-tool/.1.3.4_1.1l6r4su++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/isopackets/cordova-support/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:165
throw error;
^
ExitWithCode:1

You need to setup the plugin described here:

https://atmospherejs.com/heysailor/accounts-facebook-cordova

Hello @marc2,

I have been using accounts-facebook plugin and used which you gave me is working find. I have couple of questions.

1 ] Accounts-facebook creates users collection in mongodb and stores the information on that. How can I integrate this cordova-facebook plugin with it ? So I can store facebook information on users collection ?

2 ] Is there any cordova plugin which provides the same functionality as accounts-faceook on meteor web side ?

3] How did you manage to store facebook information on users collection if you are using accounts-facebook ?

If you get some free time then please answer asap. I’m very confused.

Thank You!

Thats exactly what heysailor:accounts-facebook-cordova does: Just call Meteor.loginWithFacebook on client side and the accounts-facebook-cordova uses the cordova plugin to login the user and creates the entry in the user collection as well.
On server side you receive the facebook information by using

Accounts.onCreateUser(function (options, user) {
 if (user.services.facebook) {
    var oauthData = user.services.facebook;
    user.profile = {};
    user.profile.gender = oauthData.gender;
    user.profile.name = oauthData.name;
 }
}
1 Like

Hello sir,

I have tried everything but not working :frowning: Can you please make a tutorial from scratch ? I’m ready to pay :slight_smile:

Thank You!