Auth0 Home Blog Docs

Error message: cannot read property 'onRedirectUri' of undefined


#1

Good morning,

I have implemented https://auth0.com/docs/quickstart/native/ionic3/01-login in an IONIC 3 application (set to native). Everything was working, but it has stopped working. I have made changes, but believe i’ve undone everything i did prior to the breakdown.

The error message I get is “user canceled” and if I enable livereload, an additional message is briefly visible that says "cannot read property ‘onRedirectUri’ of undefined. Both are exceptions thrown by the login() function in auth.service.ts.

The variable that is undefined seems to be authResult.

The logs in Auth0 say that the authentication was successful.

Can somebody point me in the right direction?


#2

My import was wrong, after changing

import { Auth0Cordova } from ‘@auth0/cordova’;

To:

import Auth0Cordova from ‘@auth0/cordova’;

It was working! Remove the curly braces {}

As explained here: https://stackoverflow.com/questions/38729486/typescript-difference-between-import-and-import-with-curly-braces and here: Auth0 Cordova Debugging Help

Hope it helps somebody else