Ionic app (android) callback problem during login

Hi guys,
we are experiencing a stucking problem.
We are using Auth0, Capacitor and Ionic5 Angular.
In the Android app the post login callback doesn’t work.
We get this error:

D/Capacitor: Sending plugin error: {"save":false,"callbackId":"82790226","pluginId":"Browser","methodName":"close","success":false,"error":{"message":"not implemented","code":"UNIMPLEMENTED"}}
E/Capacitor/Console: File: http://localhost:8100/vendor.js - Line 43878 - Msg: Error: not implemented
E/Capacitor: JavaScript Error: {"type":"js.error","error":{"message":"Uncaught Error: not implemented","url":"http://localhost:8100/polyfills.js","line":2817,"col":29,"errorObject":"{\"code\":\"UNIMPLEMENTED\"}"}}
E/Capacitor/Console: File: http://localhost:8100/polyfills.js - Line 2817 - Msg: Uncaught Error: not implemented

It seems we have a problem with a plugin but we aren’t able to find it
Thanks in advance

Hey there!

I’m not an Ionic guy but maybe will be able to help if you provide me with a link to the docs / quickstart from us you’re trying to follow

Hi Konrad. Thanks a lot for your time.
We are trying to implement this

Thank you! Let me implement it myself and debug it and I will get back to you soon!

1 Like

Hi @konrad.sopala . we go further.
Now we’ve got a problem on the Auth0 callback.
From Android side, seems do not accept the App ID.
The error is:
Login:1 Failed to launch ‘io.rexulta.ionic.angular://re2n-dev.eu.auth0.com/capacitor/io.rexulta.ionic.angular/tabs/dashboard?code=dJZXix10LhWSNY0u&state=ZEJvWWYtWWd3emU1eWU2TC5zNHZjTWdmdXFaT284aXEuOXRpd0RKR3B0Mg%3D%3D’ because the scheme does not have a registered handler .

Hi @a.tremigliozzi ,
i am stuck in the same problem as you. How do manage to go further this error?

thanks in advance

Hi, we think we found the reason of the problem.
When you try to login the system redirect to browser (the capacitor browser). In Android, capacitor has a bug: browser cannot be closed.
We are trying to find a workaround but it’s very hard
Some reference:

Hi @a.tremigliozzi. May i ask how you did tackle this problem? Because i’m facing a similar issue where the capacitor browser won’t close/redirect back to the app.

hey there!

ionic 5, capacitor3, latest android sdk and studio (Aug 17th 2021)

we get a very similar error but the current behaviour is a little different
on login the browser opens after entering valid credentials
the browser goes back to the app where the routing reloads the view but its in a wrong state and in the logcat I found the following error "E/Capacitor: JavaScript Error: {“type”:“js.error”,“error”:{“message”:“Uncaught Error: not implemented”,“url”:"http://localhost/polyfills.js",“line”:331,“col”:15,“errorObject”:“{\“code\”:\“UNIMPLEMENTED\”}”}}"

Hi @radiobird and @osk40
unfortunately we didn’t managed yet.
See this as answer: Login problem - #3 by thomasvidas - Capacitor - Ionic Forum

As stated in that issue this is not something that Capacitor supports nor do we plan on supporting it since this is the way the Android/Google recommends for all apps.

If you cannot use the way we provide, you can use the cordova-plugin-inappbrowser package GitHub - apache/cordova-plugin-inappbrowser: Apache Cordova Plugin inappbrowser

1 Like

Thanks for sharing that with the rest of community!

There is an issue with using the cordova inappbrowser. Google is not allowing authentication.

@konrad.sopala Do you have any recommendation for customers like us to deal with the current situation?
With google already forbid logging via an in-app browser, SSO naturally must be performed via a system browser. It’s fine and safe. However, the problem we are facing is that after authentication, the authorise page will continue to hang there. Both android and electron app have the same issue.

As mentioned by other users on this forum, some other providers would automatically close the browser tab after opening the callback (probably achieved by a js to open an URL on another tab and then close itself instead of the server based 302 response). Could auth0 achieve the same to provide a better user experience or is there another solution?

Hey @alvis ! sorry for the delay in the answer.
But I think the problem is not to close the browser, that is solved when after the login the callback says something like “my.app.starter://url_to_my_app”. It is like you write in your browser “mailto://” and the browser knows that has to open the email app.
This is called the “custom URL scheme”, and you have to configure that! For IoS you can find this info really valuable: Apple Developer Documentation
And for Android: Cómo crear vínculos directos al contenido de la app  |  Desarrolladores de Android  |  Android Developers

And all of this info is part of the Ionic Capacitor (Angular) docs: " This article assumes you will be using Custom URL Schemes to handle the callback within your application. To do this, YOUR_PACKAGE_ID must be registered as a URL scheme for your chosen platform. See Defining a Custom URL Scheme for iOS, or Create Deep Links to App Content for Android." (https://auth0.com/docs/quickstart/native/ionic-angular/01-login)

Please, let us know if that could solve your problem.
Regards,
Gabriel.

1 Like

Thanks for following up on that Gabriel!