Auth0 Home Blog Docs

Auth0 with Ionic

I’m trying to build login for my Ionic 4 application. I have tried with both auth0 WebAuth and auth0 Lock, which work fine locally in the browser but fail when deployed on a device. On the device, google responds with “disallowed_useragent”. I’m aware of what this error means but why is it that auth0 has not implemented a way around? Does auth0 lock not support mobile login?

I also tried using auth0/cordova but it’s badly documented so could not get it to work but I noticed it has the known issue of not working locally. It says on the github that it must be deployed to a real device for testing and that I need to fork my cod, etc. This approach is unsatisfactory.

Does Auth0 provide any technology for native login but that also works locally? As it stands I’ve tried 3 approaches and nothing works. Do I need to move to Ionic Auth Connect to achieve this?

Hi @ayrapetyan.vazgen

Welcome to the Auth0 Community Forum!

We currently have a SDK for Ionic 3:

And there is some community demand and potential support for an Ionic 4 integration:

I found a support case where a wildcard in Allowed Web Origins (CORS) was causing this error. If you dm me your tenant name. I can take a look.

Let me know.

Thanks,
Dan

Very disappointing that after almost a year after Ionic 4 release there is still no working solution. Please confirm whether auth0-lock is supposed to work on a real mobile device or not?

@ayrapetyan.vazgen,

I hear your frustration and apologize that there is not an implementation to satisfy your needs. It is important to us to listen to customer demand and provide developer-centric solutions. I highly recommend submitting some constructive feedback to our product team if you would like to communicate with them directly.

I can confirm lock works on mobile. Let me know if you have any more questions, I would be more than happy to work through them with you.

Kind Regards,
Dan

If auth0-lock works on mobile then I don’t really have a problem. The problem is that auth0-lock does not work on mobile for me. Are you saying that it works only when loaded in a browser or are you saying it working on mobile as a native app?

As I mentioned in my original post, when using lock running on the mobile device as an Ionic application and try to use Google login I get the following:

@ayrapetyan.vazgen,

I see, it wasn’t clear in your original post that you are tying to implement an embedded flow. It makes sense now why you are getting the errors, you are trying to use a web based sdk, meant for browsers.

It certainly works with browser based flow, that is what we recommend for a number of reasons, even on mobile.

For embedded, have you tried this:

Also, this blog talks about the limitations that google has set on embedded browsers. https://auth0.com/blog/google-blocks-oauth-requests-from-embedded-browsers/

@ayrapetyan.vazgen,

Also this was released today, it may be helpful.