Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Latest commit

 

History

History
149 lines (96 loc) · 5.61 KB

CHANGELOG.md

File metadata and controls

149 lines (96 loc) · 5.61 KB

Change Log

v0.4.5 (2022-05-20)

Dependencies

Various dependency updates as reported by Snky, please see this commit diff for the full list.

v0.4.4 (2021-08-27)

Dependencies

Various dependency updates. Also Webpack@4 to fix a build issue with asn1.js and [email protected] to bring in crypto-js@4 and fix a vulnerability there. #177 (stevehobbsdev)

v0.4.3 (2020-01-21)

Dependencies

  • Bump cordova-plugin-ionic-webview in /example/wkwebview #119 (dependabot)
  • Bump codecov from 3.6.1 to 3.6.5 #122 (dependabot)
  • Security upgrade url-parse from 1.4.3 to 1.4.5 #123 (dependabot)

v0.4.2 (2020-01-24)

Full Changelog

Changed

Bumped auth0-js to 9.12.2 for removal of issued-at time check #116 (stevehobbsdev)

v0.4.1 (2019-10-16)

Full Changelog

Changed

Bumped auth0-js to 9.12.0 for better OIDC compliance \113 (stevehobbsdev)

v0.4.0 (2019-10-16)

Full Changelog

Changed

v0.3.0 (2017-12-26)

Full Changelog

Changed

v0.2.0 (2017-07-07)

Full Changelog

Changed

  • Handle InAppBrowser exit event correctly #34 (decates)

v0.1.0 (2017-05-07)

Full Changelog

Requirements

The library requires these two cordova plugins to work:

  • cordova-plugin-safariviewcontroller: Shows Safari/Chrome browser ViewController/CustomTab
  • cordova-plugin-customurlscheme: Handles the custom scheme url intents for callback

you'll need to run

cordova plugin add cordova-plugin-inappbrowser
cordova plugin add cordova-plugin-customurlscheme --variable URL_SCHEME={application package name} --variable ANDROID_SCHEME={application package name} --variable ANDROID_HOST={auth0 domain} --variable ANDROID_PATHPREFIX=/cordova/{application package name}/callback

In cordova applications, the application package name is the widget's identifier in config.xml

So if you have the following values

  • application package name or widget identifier: com.auth0.cordova.example
  • auth0 domain: samples.auth0.com

in your config you should have some entries like

<plugin name="cordova-plugin-customurlscheme" spec="~4.2.0">
    <variable name="URL_SCHEME" value="com.auth0.cordova.example" />
    <variable name="ANDROID_SCHEME" value="com.auth0.cordova.example" />
    <variable name="ANDROID_HOST" value="sample.auth0.com" />
    <variable name="ANDROID_PATHPREFIX" value="/cordova/com.auth0.cordova.example/callback" />
</plugin>
<plugin name="cordova-plugin-safariviewcontroller" spec="~1.4.6" />

Setup

From npm

npm install @auth0/cordova

then in your index.js you need to register the url handler ondeviceready

var Auth0Cordova = require('@auth0/cordova');

function main() {
  function handlerUrl(url) {
    Auth0Cordova.onRedirectUri(url);
  }
  window.handleOpenURL = handlerUrl;
  // init your application
}

document.addEventListener('deviceready', main);

Usage

const auth0 = new Auth0Cordova({
  domain: '{YOUR_AUTH0_DOMAIN}',
  clientId: '{YOUR_AUTH0_CLIENT_ID}',
  packageIdentifier: '{WIDGET_ID_IN_CONFIG_XML}',
});

const options = {
  scope: 'openid profile',
};

client.authorize(options, function (err, result) {
  if (err) {
    // failure
  }
  // success!
});

This will open your tenant's hosted login page in the OS browser and will use OAuth 2.0 code grant flow with Proof Key for Code Exchange.