Download this sample project configured with your Auth0 API Keys.
- NodeJS 4.3
- Phonegap 5.5
1. Setting up the callback URL in Auth0
Go to the Client Settings section in the Auth0 dashboard and make sure that Allowed Callback URLs contains the following value:
Also, if you are testing your application locally, make sure to add your local URL as an Allowed Callback URL and the following as an Allowed Origin (CORS):
You must install the
InAppBrowser plugin to be able to show the Login popup. For that, just run the following command:
phonegap plugin add cordova-plugin-inappbrowser
Note: If you're using Phonegap Build service, you need to add the plugin using the
<plugin name="cordova-plugin-inappbrowser" />tag between the
<widget>tags inside your config.xml file. Please check this phonegap guide for more information
3. Follow the guide specific to the frontend technology you're using
Warning: Phonegap doesn't support getting dependencies from a CDN, so you're going to have to download the JS and CSS dependencies locally and then point to the downloaded files.
Warning: You must use
popupmode when configuring an application with Phonegap. (All available guides currently do that by default)
4. Sit back and relax
Now it's time to sit back, relax and open a beer. You've implemented Login and Signup with Auth0 and Phonegap.
Command failed with exit code 65 when running Phonegap build
This means that the
InAppBrowser plugin wasn't installed successfully. Try any of the followings to fix this.
- Reinstall the
phonegap plugin remove cordova-plugin-inappbrowser phonegap plugin add cordova-plugin-inappbrowser
- Remove the platform and re add it
phonegap platform remove ios phonegap platform add ios
phonegap platform remove android phonegap platform add android
- Copy the contents from the plugin to the platform plugins
cp plugins/cordova-plugin-inappbrowser/src/ios/* platforms/ios/[yourAppName]/Plugins/cordova-plugin-inappbrowser/
cp plugins/cordova-plugin-inappbrowser/src/android/* platforms/android/[yourAppName]/Plugins/cordova-plugin-inappbrowser/
Get a blank page with an OK after signin
This could mean that the
InAppBrowser plugin wasn't installed successfully.
We could not reach the server. Please try again
This means you need to install
cordova-plugin-whitelist by running following command:
ionic plugin add cordova-plugin-whitelist
After that, configure your
config.xml by adding or overriding following instructions:
<allow-navigation href="*.auth0.com" /> <access origin="*.auth0.com" />