Basic example showing how to use ngCordova to authenticate with Facebook, Twitter and Google and retrieve an access token to use with each REST API. This example is based on Nic Raboy's post and Simon Reiler's post. You can also find sources of Nic's post on GitHub.
- Apache Cordova 3.5+
- Apache Cordova InAppBrowser Plugin
- Apache Cordova White-list Plugin
- ngCordova
- jsSHA
This example application requires you to have you own Facebook, Twitter and Google applications registered with each provider. Doing so will provide you either a client id (Google, Facebook) or a consumer key and consumer secret (Twitter).
When registering each application, make sure to set the callback uri to http://localhost/callback, otherwise ngCordova will not function. As this is currently not possible via Twitter, make yourself a tiny URL, and insert that one instead.
With your credentials in hand, open www/js/app.js and replace the following lines with your own keys:
var facebook_client_id = "facebook_clientId";
var twitter_consumer_key = "twitter_consumerKey";
var twitter_consumer_secret = "twitter_consumerSecret";
var google_client_id = "google_clientId";
Ionic Framework - http://www.ionicframework.com
AngularJS - http://www.angularjs.org
Apache Cordova - http://cordova.apache.org
ngCordova - http://www.ngcordova.com
Nic Raboy's Code Blog - https://blog.nraboy.com