Google and Facebook sign-in with cordova / phonegap

Was using this earlier:
https://stackoverflow.com/a/23931392

- now is depricated for google
https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html

- and with ios the code does not work, because now when ios opens an in-app-browser instance, it deletes the browser instance where the phonegap app is running. For this to work, both windows contexts should be well alive :P

So,
Most promising option:
https://github.com/EddyVerbruggen/cordova-plugin-googleplus

Follow the steps (lots of prerequisites)

- I had to install 'q' package separately.

npm install q --save

- do take care to match your version of cordova-ios and the cordova-plugin-googleplus
(if this mismatch happens: build errors, runtime errors and dependancy problems will happen)

- do not forget to run prepare

- solving the dependancy problems
  - remove plugin, platform, node_modules

rm -rf mmapp/platforms mmapp/plugins mmapp/node_modules
  - install everything again

phonegap build ios
  - remember to add the info.plist file to the project


Error:
CDVPlugin class GooglePlus (pluginName: GooglePlus) does not exist.
- happens when two versions of the plugin are clashing
-



-x-x-x-

Facebook

https://www.npmjs.com/package/cordova-plugin-facebook4

Fork of the official plugin, but keeps the SDK version used, updated. Also, actively maintained.

Installation and Examples work out of the box.

Pointers:
- Recent updates to permissions framework
- Graph API Explorer - good tool to test out the graph queries
https://developers.facebook.com/docs/facebook-login/permissions/overview
https://developers.facebook.com/docs/facebook-login/permissions/#reference-default

Comments

Popular Posts