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:
App.jsx
import auth0 from 'auth0-js';
import Auth0Cordova from '@auth0/cordova';
import React, { Component } from 'react';
import {Tabbar, Tab} from 'react-onsenui';
import DataEntryPage from './pages/DataEntryPage';
import HomePage from './pages/HomePage';
import PersonalPage from './pages/PersonalPage';
export default class App extends Component {
This file has been truncated. show original
HomePage.jsx
import React from 'react';
import {Button, Page, Toolbar} from 'react-onsenui';
export default class HomePage extends React.Component {
loggedIn = false ? true : false;
username = 'SomeUser';
render() {
return (
<Page
This file has been truncated. show original
index.js
import Auth0Cordova from '@auth0/cordova';
import React from 'react';
import ReactDOM from 'react-dom';
import 'onsenui/css/onsenui.css';
import 'onsenui/css/onsen-css-components.css';
import App from './App';
const intentHandler = (url) => {
Auth0Cordova.onRedirectUri(url);
This file has been truncated. show original
There are more than three files. show original
Nvm, fixed.
Issue was that I needed to change:
this: import { Auth0Cordova } from '@auth0/cordova';
→
to this: import Auth0Cordova from '@auth0/cordova';
Glad you were able to figure it out!