Cordova facebook plugin


#1

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!


#2

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


#3

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


#4

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.


#5

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;
            ^

#6

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


#7

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


#8

You need to setup the plugin described here:

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


#9

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!


#10

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;
 }
}

#11

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!