AeroGear OAuth2 Cordova
The plugin handles OAuth2 authorization code grant in a secure manner. The OAuth2 dance uses external browser approach, OAuth2 access and refresh tokens are stored securely encrypted in your native device. Supports iOS, android and windows phone platforms.
The plugin wraps the following libs:
If you want to see the plugin in action please refer to aerogear-cordova-cookbook Shoot'nShare demo app or/ad just follow the Getting started guide to create your own.
|License:||Apache License, Version 2.0|
|Mailing lists:||aerogear-users (subscribe)|
The Cordova command line tooling is based on node.js so first you’ll need to install node then you can install Cordova by executing:
$ npm install -g cordova
To deploy on iOS you need to install the ios-deploy package as well
$ npm install -g ios-deploy
Create the App
Create a new app by executing:
$ cordova create <project-name> [app-id] [app-name]
Specify a set of target platforms by executing:
$ cordova platform add <platform>
The available platform values are ios and android.
Install the plugin
Install the aerogear-oauth2-cordova plugin by executing:
$ cordova plugin add aerogear-cordova-oauth2
wwww/js/index.js file, to start the OAuth2 dance as soon as
onDeviceReady event is fired, add the following snippet:
Google Play Services
On Android you can use Google Play Services to retrieve an Oauth2 token using on of the device's authorized accounts.
To make the Google Play Services available to your application, be sure to add the
com.google.playservices cordova plugin to your project.
Then request an Oauth2 token using Google Play Services as in this example:
For our OAuth2 on iOS plugin we use external browser approach, in order to re-enter the app you need to provide a URI schema. This is called the
redirect_uri. By convention Google uses your iOS bundle. Facebook uses as
redirect_uri 2 letters
fb followed by the
client_id. As the
client_id is not in your config.xml, once the project is deployed you will have to go to [project_name]-info.plist and modify it to change fbYYY where YYY is your facebook
When you need / want to build the project with Xcode you'll need to make some changes to the project
This is a very early version:
- expose refreshToken, revokeToken
For more details about the current release, please consult our documentation.
If you would like to help develop AeroGear you can join our developer's mailing list, join #aerogear on Freenode, or shout at us on Twitter @aerogears.
Also takes some time and skim the contributor guide
Join our user mailing list for any questions or help! We really hope you enjoy app development with AeroGear!
Found a bug?
If you found a bug please create a ticket for us on Jira with some steps to reproduce it.