Ionic: facebook and google login, from respective native apps, with a Phonegap Build app


Can someone point me to a plugin or a code snippet to implement both Facebook and Google login in my Ionic + Phonegap Build app ?

I would like this feature to be able to log from the native facebook or google+ apps that the user has already installed on his device, so he doesn’t need to retype his id+password. But, if these apps are not installed, the code must fallback on the normal login process.

My app communicate with a cloudant database using pouchDB in case you need this information.

(I have to use Phonegap Build because I don’t work on a mac).


1 Like

I have a tutorial on adding Facebook login functionality to Facebook (using Parse):

This uses the native Facebook app, but it’s using the ngCordova plugin. The same plugin is available on PGB though: so obviously you’ll have to use that but all the rest of the tutorial should be the same.

Can’t help you with Google+ but I have seen a PGB plugin for that as well:

1 Like

Thanks but I’m not willing to use Parse.
Is there a tuto for using the phonegap build plugin with a code working as a pure web app too ?

see facebook login example here

Hi, the following posts are amazing and will guide you on how to add Facebook and Google+ Native Logins to your Ionic apps:


could you add how to get name and email of the user and save it to Parse to your tutorial?

Thanks @virender, do you think ng-cordova would work with Phonegap Build ? (I’m using PG build to compile my app, because I don’t have a Mac)

Thanks @dayanajabif, do you think these methods will work flawlessly with Phonegap Build as well ?

Yes, It should work.

Hi @dayanajabif, thanks for both of your links.
I followed the tutorial for Facebook log in. But now when I run my app in android :

ionic run android -lcs

I get this error, as if the plugin was not here :smile:

13    249714   error    ReferenceError: facebookConnectPlugin is not defined
at k.$scope.facebookSignIn (

Can you help please ?

Hi, that error seems to be because facebookConnectPlugin is not present in the environment you are testing. Where are you testing the app? You should test it on a real device or in the emulator.

indeed I am testing in my android device, with the command : ionic run android -lcs

i also used one of these link for facebook login but whenever i try to login on my android device but it show error “Invalid hash key. the hash key +H9I4+vy46g8b… does not matched any stored hash key…” how to fix it