Meteor, accounts-facebook vs. ionic client

Hey there,
currently I’m, working on a project consisting of a meteor backend and a cordova/ionic client. So far everything went well while using the angular-meteor framework. Whit what i’m strugglin gnow is integration OAuth with Facebook.

On the server side i have the accounts-facebook package but contrary to for example accounts-password there is no specific client side package i could install with bower on ionics side.
Everything i found (and installed) is: accounts-base-client-side

So my question: Is the accounts-facebook package supposed to be used on a mobile client and if yes, how?

Thanks for any help or a nudge in the right direction!
Bear with me, I’m still new here;)

2 Likes

I’m hacking together a version right now. It’s not simple, but I’ve got something that works in the browser. Still trying to find a solution for running from a device. I’m open to suggestions.

See my repo:

Issues:

1 Like

Ah i totally forgot to come back to my topic. I currently solved it with a manual call to

Meteor.loginWithFacebook({loginStyle: "redirect"});
which works on cordova/ionic for me. The loginStyle seems to be important, as modal doesn’t work on iOS.
The only package in use here is accounts-facebook, same for twitter.

The facebook oAuth redirect URL is : http://localhost:3000/_oauth/facebook
And in meteor i set up the service like this:

//first, remove configuration entry in case service is already configured
ServiceConfiguration.configurations.remove({
    service: "facebook"

});

ServiceConfiguration.configurations.insert({
    service: "facebook",
    appId: "XXX",
    secret: "XXX",
    loginStyle: "redirect"
});
1 Like

I tried loginStyle="redirect" and I get as far as the “login completed” redirect page, but I can’t seem to close the page and get back to my app. When I click on the close link, I get an exception that says

Scripts may close only the windows that were opened by it.

any ideas?

Does loginStyle="redirect" work with ionic View? I discovered that the accounts-facebook-cordova plugin is not available from there, so some kind of login would be helpful,

Scripts may close only the windows that were opened by it.

Found out this issue was because the OAuth redirect page goes to the Meteor Server, which is not running on the same address when you use accounts-facebook-client-side I fixed that problem with a proxy, but I’m still not getting the oauth secret correctly.

I don’t know how to redirect from Facebook oauth to the Meteor Server (as a 3rd-party oauth URL) to the ionic client-side

Hi , Did you fix this issue ?

No, not with loginStyle: "redirect". But I got it working with the Cordova plugin, so I didn’t try very hard.

Right now I’m serving my Ionic app as a single-page-app on my server, but at some point I have to look into putting it behind the node server running the Meteor server-side (via mupx). I think that things will work out better when everything is on the same domain/port

May i know what Cordova plugin did you use ?

I am already using Ionic / Angular with Meteor in my current project … Everything works fine but the Social login does not work like it should !

see above: https://github.com/mixersoft/accounts-facebook-client-side

Let me know if you have problems, and submit a pull-request if you can make the whole thing work easier…

Sure will do thank you …

Great job on the accounts-facebook-client-side repo! Seems to work well except for the proxy because I use angular v2. Do you have an angular 2 version of the oauth proxy?