Auth0 Cordova
Library to make it easy to integrate Auth0 login in your Cordova applications.
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-safariviewcontrollercordova 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
Setup
From npm
npm install @auth0/cordova
then in your index.js you need to register the url handler ondeviceready
var Auth0Cordova = ; { { Auth0Cordova; } windowhandleOpenURL = handlerUrl; // init your application} document;
Usage
const auth0 = domain: "{YOUR_AUTH0_DOMAIN}" clientId: "{YOUR_AUTH0_CLIENT_ID}" packageIdentifier: "{WIDGET_ID_IN_CONFIG_XML}"; const options = scope: 'openid profile'; client;
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.
API
For more information about our API please check our online documentation
Issue Reporting
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
For auth0 related questions/support please use the Support Center.
Author
License
This project is licensed under the MIT license. See the LICENSE file for more info.