npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aerogear-cordova-oauth2

v1.0.5

Published

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 platfor

Downloads

6

Readme

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.

| | Project Info | | --------------- | ------------- | | License: | Apache License, Version 2.0 | | Build: | Cordova Plugin | | Documentation: | https://aerogear.org/docs/specs/aerogear-cordova/ | | Issue tracker: | https://issues.jboss.org/browse/AGCORDOVA | | Mailing lists: | aerogear-users (subscribe) | | | aerogear-dev (subscribe) |

Getting Started

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]

Add platform(s)

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

Sample example

In wwww/js/index.js file, to start the OAuth2 dance as soon as onDeviceReady event is fired, add the following snippet:

  onDeviceReady: function () {
    app.receivedEvent('deviceready');
    oauth2.addGoogle({
      name: 'gplus',
      settings: {
        clientId: "617285928032-nnkcrot1827fmd738pug6clbqlgosffs.apps.googleusercontent.com",
        scopes: 'https://www.googleapis.com/auth/drive'
      }
    });

    oauth2.addKeycloak({
      name: 'keycloak',
      settings: {
        base: 'http://192.168.1.15:8080/auth',
        clientId: 'shoot-third-party',
        realm: "shoot-realm"
      }
    });

    oauth2.addFacebook({
      name: 'facebook',
      settings: {
        clientId: '1511044619160050',
        clientSecret: '3b08052d3d96e2120f2c53a36eebd02f',
        scopes: 'photo_upload, publish_actions'
      }
    });

    oauth2.gplus.requestAccess()
      .then(function (token) {
        console.log(token);
        // add token to the http header on futher http requests:
        // 'Authorization': 'Bearer ' + token
      }, function (err) {
        alert(err.error);
      });
  },

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:

   oauth2.requestAccessUsingPlayServices({
        scopes: 'openid',
        accountTypes: 'com.google'
     })
     .then( function( accessToken ){
        ...
     })
     .catch( function( error ) {
        // an error happened
     });
   });

Facebook iOS

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 client_id.

Xcode

When you need / want to build the project with Xcode you'll need to make some changes to the project

Todo

This is a very early version:

  • expose refreshToken, revokeToken

Documentation

For more details about the current release, please consult our documentation.

Development

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

Questions?

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.