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

cordova-plugin-oauth

v4.0.1

Published

Cordova plugin for performing OAuth login flows.

Downloads

547

Readme

cordova-plugin-oauth

This plugin provides a mechanism for showing an OAuth flow in a secured system-provided browser view and receiving the result via a Message event.

On iOS, this uses ASWebAuthenticationSession (iOS >=12), SFAuthenticationSession (iOS 11), SFSafariViewController (iOS >=8, <=10), falling back to Safari.

On Android, this uses Custom Tabs in the user's preferred web application, falling back to their browser.

Note: This plugin might conflict with the Cordova In-App Browser plugin!

ℹ️ This plugin uses AndroidX!

Use version 3.x if you are building without AndroidX enabled.

Installation

cordova plugin add cordova-plugin-oauth [--variable URL_SCHEME=mycoolapp]

By default, the plugin registers the app ID as a scheme to be used as the OAuth callback URL, and expects a host of oauth_callback (i.e., if your app's ID is com.example.foo, your OAuth redirect URL should be com.example.foo://oauth_callback).

The scheme for the OAuth callback URL can be changed by providing a URL_SCHEME variable when installing. If your URL_SCHEME is mycoolapp, then your OAuth redirect URL should be mycoolapp://oauth_callback.

Supported Platforms

  • iOS (cordova-ios >= 6.1.0)
  • Android (cordova-android >= 9.0.0)

Usage

  1. Trigger the plugin by opening the OAuth login page in a new window, with a window name that includes "oauth:":

    var endpoint = 'https://accounts.google.com/o/oauth2/v2/auth?....';
    window.open(endpoint, 'oauth:google', '');
  2. The plugin will open the OAuth login page in a new browser window.

  3. When the OAuth process is complete and it redirects to your app scheme, the plugin will send a message to the Cordova app.

    The message begins with oauth:: and is followed by a JSON object containing all of the key/value pairs from the OAuth redirect query string.

    // Called from a callback URL like
    // com.example.foo://oauth_callback?code=b10a8db164e0754105b7a99be72e3fe5
    // it would be received in JavaScript like this:
    
    window.addEventListener('message', function(event) {
      if (event.data.match(/^oauth::/)) {
        var data = JSON.parse(event.data.substring(7));
    
        // Use data.code
      }
    }

    The advantage of this implementation is that it can be made to work with Universal Links and App Links so that the same flow can be used in both mobile apps and web.

Contributing

Contributions of bug reports, feature requests, and pull requests are greatly appreciated!

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Licence

Released under the Apache 2.0 Licence.
Copyright © 2020-2022 Ayogo Health Inc.