Integrating Auth0 with a cordova jQuery mobile app

Viewed 75

I am trying to integrate Auth0 authentication with my already made cordova mobile app. I set up the client and was following the quick start guide from auth0. The problem I am facing is that the guide does not seem to be suitable for a jQuery app because it uses require and in the end builds a module. I am not sure how to do this using jQuery, since all other js files I have are inside www/js folder and I do not know how to import node_modules inside my app.

var Auth0 = require('auth0-js');
var Auth0Cordova = require('@auth0/cordova');
....
....
module.exports = App;
  1. Can anyone tell me how can I do this without making much modification to my current app.
  2. If not possible to set this up with jQuery, what other ways are there to do this?
1 Answers

Not sure how you are trying to use jQuery. But the easiest option is simply to add the jQuery dependency to your js folder, and reference using the usual script header in index.html.

Couple of resources for points here and if wishing to use an npm module then see here. This is doing something similar, adding the needed js dependencies to the jsfolder, and then updating index.html to reference to those js dependencies.

Finally, it is possible to extend webpack to reference jQuery - see an answer I posted separately on that here.

Related