Facebook login ionic

Hi, I was wondering if anyone has been able to get Facebook login to work with ionic2? If so, may I please ask if you could share the steps of how how you did this? I was using a cordova plugin with ionic1 for FB login and I had it working, but can’t get it to work with ionic2.

2 Likes

I’ve seen many questions on how to do this in Ionic2 and I just made a simple demo that may help. It does use a Cordova plugin for the Facebook SDK that gives you native Facebook authentication.

Please note that you can NOT try this with “ionic serve” or via Ripple. You need to run it on a real device or at least on an emulator.

See ionic2-native-facebook-login for more info.

2 Likes

B-E-A-UUUUTIFUL! Exactly what I was looking for! Thanks so much!

hey were u able to get this working, for me i get the error on browser, on emulator it does nothing.

Im having problems with it as well. is the syntax still correct?

is there any way to support browser?

1 Like

Im using facebook4 plugin, but it does not invoke on browser, meaning if user doesnt have fb installed it wont open the inbrowser login, this is sad, but need a way to implement this.

I’m using this, it works on Android perfectly but it doesn’t on IOS.

Did anyone figure out how to make it work?

Hi!
How about making api calls, can you define the method to use? (GET, POST,… )

The javascript sdk on Facebook has:
FB.api(path, method, params, callback)

but this facebook plugin has:

api(requestPath, permissions)

Thanks

I created a tutorial that shows - step by step - how to integrate Facebook Login to an Ionic 2 App: https://ionicthemes.com/tutorials/about/ionic2-facebook-login you can also see the repo here: https://github.com/ionicthemes/ionic2-facebook-login!
Enjoy :slight_smile:

5 Likes

this gives me a blank page … https://ionicthemes.com

Please try to disable your adblocker and then try again.

Hello @dayanajabif
Your links are very helpful, but I have one thing to implement your sample.
I have already implemented your sample step by step.
The app it’s logged but display following screen.

And I click the Ok button, it’s redirect login page again.
How can I fix that?
Thank you.

What do you mean by “it’s redirect login page again.” ? Which login page?

I have create Facebook login button in login page.
After click that button, everything is okay, but after authentication, page redirect login page again, not navigate index page.

From the code in https://ionicthemes.com/tutorials/about/ionic2-facebook-login#step3, inside Login section, just change nav.push(UserPage); with the page you want to redirect the user after Facebook login is completed.

Thank you for your help @dayanajabif.
I solved it.

1 Like

I think it’s not working anymore, i executed the github code and it doesn’t work on simulator and on android device, opens a blank page.

Why aren’t you using the builtin ionic auth service https://docs.ionic.io/services/auth/ ?

Here’s an example of Facebook auth with Ionic Cloud:

1 Like