Skip to content

rwforest/ng-cordova-oauth-example

 
 

Repository files navigation

PayPal

Oauth Example for Ionic Framework

This example will demonstrate how to use ngCordova to authenticate with various oauth providers and retrieve an access token for use with their API.

Requirements

  • Apache Cordova 3.5+
  • Apache Cordova Whitelist Plugin
  • Apache Cordova InAppBrowser Plugin
  • Apache Cordova Keyboard Plugin
  • Apache Cordova Statusbar Plugin

Configuration

The Recommended Way

Run the following to install all necessary platforms and plugins:

ionic state reset

The Manual Way

Download this example project from GitHub and run the following commands:

$ ionic platform add android
$ cordova plugin add org.apache.cordova.inappbrowser
$ cordova plugin add cordova-plugin-whitelist
$ cordova plugin add cordova-plugin-keyboard
$ cordova plugin add cordova-plugin-statusbar

The above commands will add the Android build platform and install the required Apache InAppBrowser plugin.

Provider Setup

This example application requires you to have your own provider application registered with whatever provider you choose to use. Doing so will give you a unique client id that can be included into your project. When registering your application with an oauth provider, make sure to set the callback uri to http://localhost/callback, otherwise ngCordova will not function.

With the client id and information in hand, open www/js/app.js and add where appropriate.

Usage

With this example project configured on your computer, run the following from the Terminal or command prompt:

$ ionic build android

Install the application binary to your device or simulator.

Have a question or found a bug (compliments work too)?

Tweet me on Twitter - @nraboy

Resources

Ionic Framework - http://www.ionicframework.com

AngularJS - http://www.angularjs.org

Apache Cordova - http://cordova.apache.org

ngCordova - http://www.ngcordova.com

The Polyglot Developer - https://www.thepolyglotdeveloper.com

About

A simple test application for ng-cordova-oauth

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 85.9%
  • CSS 14.1%