Auth0 Home Blog Docs

TypeError: Cannot read property 'isAvailable'

auth0
login

#1

I have made a test app to use auth0 on Ionic. Whenever I run ‘auth.login()’, I get the following error:

Blockquote
TypeError: Cannot read property ‘isAvailable’ of undefined
at Function.Browser.isAvailable (vendor.js:sourcemap:149943)
at getAgent (vendor.js:sourcemap:149922)
at CordovaAuth.authorize (vendor.js:sourcemap:87291)
at AuthProvider.webpackJsonp.131.AuthProvider.login (main.js:sourcemap:68)
at Object.eval [as handleEvent] (HomePage.html:17)
at handleEvent (vendor.js:sourcemap:13963)
at callWithDebugContext (vendor.js:sourcemap:15472)
at Object.debugHandleEvent [as handleEvent] (vendor.js:sourcemap:15059)
at dispatchEvent (vendor.js:sourcemap:10378)
at vendor.js:sourcemap:11003
Blockquote

I’ve checked plugins and dependencies and followed the ionic auth0 documentation, yet I cant get it to work.
I hope someone can help me with it.

MyCode:
ioauthapp2


#2

According to this answer in StackOverflow:

ionic serve does not load cordova plugins.

Auth0 uses auth0-cordova plugin which in turn requires:

  • cordova-plugin-safariviewcontroller
  • cordova-plugin-customurlscheme

All these require you to run the ionic app in your device or emulator if you want to test the login functionality.