Auth0 Home Blog Docs

Getting “Auth0Cordova is not a constructor” when using auth0 for react+cordova

auth0
login

#1

I am trying to use auth0 in my Cordova app which also makes use of React. I’ve seen a tutorial for using auth0 with Cordova, and one for use with React, but none that combines both, so I’m kind of winging it.

When clicking my login button, I get the following error: TypeError: __WEBPACK_IMPORTED_MODULE_1__auth0_cordova__.Auth0Cordova is not a constructor

Here is are images of the stack trace:


I’ve made a gist of the 3 relevant files here:


#2

Also posted a GH issue on Auth0Cordova: https://github.com/auth0/auth0-cordova/issues/89


#3

Nvm, fixed.

Issue was that I needed to change:
this: import { Auth0Cordova } from '@auth0/cordova';
–>
to this: import Auth0Cordova from '@auth0/cordova';