All Projects → auth0 → auth0-cordova

auth0 / auth0-cordova

Licence: MIT license
Auth0 integration for Cordova apps

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to auth0-cordova

ZeroConf
ZeroConf plugin for Cordova/Phonegap 3.0
Stars: ✭ 39 (-18.75%)
Mutual labels:  cordova-plugin
cordova-plugin-appminimize
This is a cordova plugin to minimizes the application in android devices
Stars: ✭ 39 (-18.75%)
Mutual labels:  cordova-plugin
cordova-plugin-webpack
Integrate webpack into your Cordova workflow.
Stars: ✭ 61 (+27.08%)
Mutual labels:  cordova-plugin
cordova-plugin-purchases
Cordova in-app purchases and subscriptions made easy.
Stars: ✭ 52 (+8.33%)
Mutual labels:  cordova-plugin
express-oauth2-bearer
Experimental Middleware for express.js to validate access tokens.
Stars: ✭ 30 (-37.5%)
Mutual labels:  dx-sdk
auth0-android-sample
Auth0 Integration Samples for Android Applications
Stars: ✭ 61 (+27.08%)
Mutual labels:  dx-sdk
cordova-plugin-shell-exec
Apache Cordova Plugin to Execute Commands in Smartphone's Operating System Shell
Stars: ✭ 30 (-37.5%)
Mutual labels:  cordova-plugin
cordova-spotify
🎶 A Cordova / PhoneGap plugin for the Spotify SDKs on iOS and Android
Stars: ✭ 22 (-54.17%)
Mutual labels:  cordova-plugin
auth0-aspnet-owin-webapi-samples
Auth0 Integration Samples for ASP.NET OWIN Web API Services
Stars: ✭ 25 (-47.92%)
Mutual labels:  dx-sdk
auth0-aspnetcore-mvc-samples
Auth0 Integration Samples for ASP.NET Core MVC Web Applications
Stars: ✭ 120 (+150%)
Mutual labels:  dx-sdk
cordova-study
📱 Cordova学习记录,Cordova插件的使用,热更新、media、device、集成x5内核等等。
Stars: ✭ 19 (-60.42%)
Mutual labels:  cordova-plugin
Create-a-custom-Cordova-plugin
How to create a custom cordova plugin and bridge it between your native code and a new or existing Cordova project
Stars: ✭ 32 (-33.33%)
Mutual labels:  cordova-plugin
hms-cordova-plugin
This repo contains all of Cordova HMS plugins.
Stars: ✭ 78 (+62.5%)
Mutual labels:  cordova-plugin
cordova-plugin-example
Example Cordova plugin for iOS and Android to support blog post.
Stars: ✭ 15 (-68.75%)
Mutual labels:  cordova-plugin
Auth0.Android
Android toolkit for Auth0 API
Stars: ✭ 138 (+187.5%)
Mutual labels:  dx-sdk
JiaCordova
在Cordova及插件的基础上封装一些常用的功能,不断更新中
Stars: ✭ 35 (-27.08%)
Mutual labels:  cordova-plugin
cordova-plugin-downloadmanager
A Cordova plugin to download file in system's default download manager
Stars: ✭ 45 (-6.25%)
Mutual labels:  cordova-plugin
cordova-plugin-ironsource-ads
Cordova plugin for IronSource ads
Stars: ✭ 17 (-64.58%)
Mutual labels:  cordova-plugin
cordova-plugin-dbmeter
🎤📣 Cordova plugin to get decibels from the microphone
Stars: ✭ 33 (-31.25%)
Mutual labels:  cordova-plugin
ionic-hockeyapp
Need HockeyApp in your Ionic application, add this package!
Stars: ✭ 19 (-60.42%)
Mutual labels:  cordova-plugin

Auth0 Cordova

FOSSA Status

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-safariviewcontroller
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

<preference name="AndroidLaunchMode" value="singleTask" />
<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',
};

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

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.

Common Issues

  1. The plugin is not working in Ionic / Cordova dev app.

    The plugin needs to be deployed on a real device to function, this is so because the dev apps do not add the necessary plugins needed for this library to function correctly. You'll need to either create a clone / fork of the Dev App or need to deploy it to a real device to test.

  2. The app hangs after authentication

    If 1 does not solve your problem, please make sure you have cordova-plugin-customurlscheme installed or an appropirate plugin to handle the callback (like deeplinks / universal links) and you are handling the callback appropriately

Author

Auth0

License

This project is licensed under the MIT license. See the LICENSE file for more info.

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].