Auth0 Home Blog Docs

Ionic 2+ Mobile and Web Hosted

angular4
ionic2

#1

Hello my Ionic application will be deployed both as Apps on mobile, and hosted as a web app. How can I make the Auth0 Login available in web mode without getting the Cannot read property ‘isAvailable’ error?

Can I use auth0-js and auth0-lock at the same time as the cordova version? And somehow tell the app which on to use base on the device?


#2

Technically you can venture yourself into detecting the platform where the application is running and reacting accordingly, in this case that would mean using different authentication flows. I’m not sure if that is the recommendation or if platform detection can be done in a robust way; a quick Google search points to this thread in Ionic forum that you may want to read.


#3

Thanks, I agree that this is not the optimum solution, I will try the non cordova approach using my Auth service that was built for an Angular 2 app, using auth0-js and auth0-lock, I will just try to figure out the callback url depending on the device.


#4

Any update? It is easy to detect the platform in Ionic: https://ionicframework.com/docs/developer-resources/desktop-support/

However, what should we do for mobile web, native, or desktop web? For native, I guess? https://auth0.com/docs/quickstart/native/ionic2/01-login

Then for mobile or desktop web? https://auth0.com/docs/quickstart/spa/angular2

It would be easier to have one way; probably could be the SPA flow, but that shows a hosted login page (HLP). It wont work without connectivity in the native situation. Any way to replace HLP with a prebuilt one and use same solution?


#5

We actually stopped using Auth0 for now because of this, and we concentrate on the rest of the app, we might get back to it later.


#6

I’m having this issue as well. I want my app to work as a Progressive Web App (a fully supported part of the ionic family) and as native apps however the auth0 implementation for ionic only provides for the native app implementation.

The instructions for angular 2 + also require using the angular router which isn’t part of ionic. Would really like some clarification on whether this will be supported and possibly when.


#7

Anyone has found an answer to this yet?


#8

I tried to get it to work but to no avail. We had to abandon ionic development for now until there’s a supported solution.


#9

I tried to get it to work but to no avail. We had to abandon ionic development for now until there’s a supported solution.


#10

We actually stopped using Auth0 for now because of this, and we concentrate on the rest of the app, we might get back to it later.


#11

Anyone has found an answer to this yet?


#12

I’m having this issue as well. I want my app to work as a Progressive Web App (a fully supported part of the ionic family) and as native apps however the auth0 implementation for ionic only provides for the native app implementation.

The instructions for angular 2 + also require using the angular router which isn’t part of ionic. Would really like some clarification on whether this will be supported and possibly when.


#13

Any update? It is easy to detect the platform in Ionic: https://ionicframework.com/docs/developer-resources/desktop-support/

However, what should we do for mobile web, native, or desktop web? For native, I guess? https://auth0.com/docs/quickstart/native/ionic2/01-login

Then for mobile or desktop web? https://auth0.com/docs/quickstart/spa/angular2

It would be easier to have one way; probably could be the SPA flow, but that shows a hosted login page (HLP). It wont work without connectivity in the native situation. Any way to replace HLP with a prebuilt one and use same solution?


#14

@myemail12291 the link you provided shows platform detection as easy, but that the link in the answer seems to imply there’s more to it. In addition, web and native as very different platforms so there will always be a sort of impedance mismatch if try the one size fits all approach (but that’s just my opinion).


#15

In the meantime, is the a pure JS approach that would work with Ionic as a web SPA ?


#16

I was thinking of doing that myself but the angular method also requires that you use the angular router and not the ionic router… Do you know if its possible to implement the angular router alongside the ionic router?


#17