Skip to content

Latest commit

 

History

History
123 lines (85 loc) · 4.87 KB

phonegap.md

File metadata and controls

123 lines (85 loc) · 4.87 KB
lodash title name alias language framework hybrid image tags snippets
true
Phonegap Tutorial
Phonegap
phonegap
Javascript
Cordova
true
//auth0.com/lib/platforms-collection/img/phonegap.png
quickstart
dependencies setup use
native-platforms/phonegap/dependencies
native-platforms/jquery/setup
native-platforms/jquery/use

Phonegap tutorial

To Run the example

In order to run the project, you need to have `node`, `cordova` and `ios-sim` installed. Once you have that, just clone the project and run the following:

cordova build ios
cordova emulate ios

<% if (configuration.api && configuration.thirdParty) { %>

<% } else { %>

<% } %>

Otherwise, if you already have an existing application, please follow the steps below.

0. Setting up the callback URL in Auth0

Go to the Application Settings section in the Auth0 dashboard and make sure that Allowed Callback URLs contains the following value:

https://@@account.namespace@@/mobile

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):

file://\*

1. Add InAppBrowser plugin

You must install the InAppBrowser plugin from Cordova to be able to show the Login popup. For that, just run the following command:

@@snippet(meta.snippets.dependencies)@@

Note: If you're using Phonegap Build service, you need to add the plugin using <gap:plugin. Please check this phonegap guide for more information

2. Follow the guide specific to the FrontEnd technology you're using

Now, you can just follow the tutorial for the FrontEnd technology that you're using. We currently support applications using jQuery, AngularJS and Vanilla JS.

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 popup mode when configuring an application with Phonegap. (All available guides currently do that by default)

3. 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 Cordova.

Troubleshooting

Command failed with exit code 65 when running ionic build

This means that the InAppBrowser plugin wasn't installed successfully by Cordova. Try any of the followings to fix this.

  • Reinstall the InAppBrowser plugin
ionic plugin remove org.apache.cordova.inappbrowser
ionic plugin add org.apache.cordova.inappbrowser
  • Remove the platform and re add it
ionic platform remove ios
ionic platform add ios
  • Copy the contents from the plugin to the platform plugins
cp plugins/org.apache.cordova.inappbrowser/src/ios/* platforms/ios/[yourAppName]/Plugins/org.apache.cordova.inappbrowser/

Get a blank page with an OK after signin

This could mean that the InAppBrowser plugin wasn't installed successfully by Cordova. If you are seeing this error only when viewing your app in the ionic viewer app, this article suggests that InAppBrowser is not yet supported. You can verify this by running the app in your emulator or in the browser. See the previous section to learn how to solve this.