# Ionic app (android) callback problem during login

**URL:** <https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868>\
**Category:** Get Help\
**Created:** [July 27, 2021, 11:00am UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868 "2021-07-27T11:00:55Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.tremigliozzi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/a.tremigliozzi/32/30779_2.png) [@a.tremigliozzi](https://community.auth0.com/u/a.tremigliozzi)\
**Post date:** [July 27, 2021, 11:00am UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/1 "2021-07-27T11:00:55Z")

</div>

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:

```auto
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

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [July 27, 2021, 11:32am UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/2 "2021-07-27T11:32:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![a.tremigliozzi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/a.tremigliozzi/32/30779_2.png) [@a.tremigliozzi](https://community.auth0.com/u/a.tremigliozzi)\
**Post date:** [July 27, 2021, 11:41am UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/3 "2021-07-27T11:41:45Z")

</div>

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

> **[Auth0 Ionic & Capacitor (Angular) SDK Quickstarts: Login](https://auth0.com/docs/quickstart/native/ionic-angular)**
>
> This tutorial demonstrates how to add user login with Auth0 to an Ionic Angular & Capacitor application.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [July 27, 2021, 11:56am UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/4 "2021-07-27T11:56:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![a.tremigliozzi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/a.tremigliozzi/32/30779_2.png) [@a.tremigliozzi](https://community.auth0.com/u/a.tremigliozzi)\
**Post date:** [July 29, 2021, 8:23am UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/6 "2021-07-29T08:23:48Z")

</div>

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**.

---

<div class="post-metadata">

**Author:** ![tardelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tardelli/32/30842_2.png) [@tardelli](https://community.auth0.com/u/tardelli)\
**Post date:** [July 29, 2021, 5:55pm UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/7 "2021-07-29T17:55:18Z")

</div>

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

thanks in advance

---

<div class="post-metadata">

**Author:** ![a.tremigliozzi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/a.tremigliozzi/32/30779_2.png) [@a.tremigliozzi](https://community.auth0.com/u/a.tremigliozzi)\
**Post date:** [July 30, 2021, 8:54am UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/8 "2021-07-30T08:54:14Z")

</div>

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:

> <https://github.com/ionic-team/capacitor/issues/1414>
>
> Description of the problem:
> 
> The close function from the browser plugin doesn'…t close a window on android.
> 
> Affected platform
> \- \[x\] Android
> \- \[\] iOS
> \- \[\] electron
> \- \[\] web
> 
> OS of the development machine
> \- \[\] Windows
> \- \[x\] macOS
> \- \[\] linux
> 
> Capacitor version: 1.0.0-beta.19
> 
> node version: v11.12.0
> 
> npm version: 6.9.0
> 
> Steps to reproduce: 
> \`\`\`js
> Capacitor.Plugins.Browser.open({'url': 'http://localhost:8080/close'});
> setTimeout(function() { Capacitor.Plugins.Browser.close(); }, 5000);
> \`\`\`

---

<div class="post-metadata">

**Author:** ![osk40](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/osk40/32/31192_2.png) [@osk40](https://community.auth0.com/u/osk40)\
**Post date:** [August 17, 2021, 12:34pm UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/9 "2021-08-17T12:34:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![radiobird](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/radiobird/32/15820_2.png) [@radiobird](https://community.auth0.com/u/radiobird)\
**Post date:** [August 17, 2021, 5:30pm UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/10 "2021-08-17T17:30:43Z")

</div>

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\”}”}}"](http://localhost/polyfills.js%22,%22line%22:331,%22col%22:15,%22errorObject%22:%22%7B%5C%22code%5C%22:%5C%22UNIMPLEMENTED%5C%22%7D%22%7D%7D%22)

---

<div class="post-metadata">

**Author:** ![a.tremigliozzi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/a.tremigliozzi/32/30779_2.png) [@a.tremigliozzi](https://community.auth0.com/u/a.tremigliozzi)\
**Post date:** [August 23, 2021, 7:46am UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/11 "2021-08-23T07:46:59Z")

</div>

Hi @radiobird and @osk40  
unfortunately we didn’t managed yet.  
See this as answer: [Login problem - #3 by thomasvidas - Capacitor - Ionic Forum](https://forum.ionicframework.com/t/login-problem/213011/3?u=atremigliozzi)

> As stated in [that issue](https://github.com/ionic-team/capacitor/issues/1414#issuecomment-485396236) 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](https://github.com/apache/cordova-plugin-inappbrowser)

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 23, 2021, 8:19am UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/12 "2021-08-23T08:19:01Z")

</div>

Thanks for sharing that with the rest of community!

---

<div class="post-metadata">

**Author:** ![djeter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/djeter/32/13255_2.png) [@djeter](https://community.auth0.com/u/djeter)\
**Post date:** [September 9, 2021, 11:22pm UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/13 "2021-09-09T23:22:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alvis](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alvis/32/32363_2.png) [@alvis](https://community.auth0.com/u/alvis)\
**Post date:** [October 15, 2021, 5:29pm UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/14 "2021-10-15T17:29:08Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![gabriel.valdez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gabriel.valdez/32/32409_2.png) [@gabriel.valdez](https://community.auth0.com/u/gabriel.valdez)\
**Post date:** [November 11, 2021, 6:58pm UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/15 "2021-11-11T18:58:14Z")

</div>

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](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app)  
And for Android: [Cómo crear vínculos directos al contenido de la app &nbsp;|&nbsp; Desarrolladores de Android &nbsp;|&nbsp; Android Developers](https://developer.android.com/training/app-links/deep-linking)

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](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app) for iOS, or [Create Deep Links to App Content](https://developer.android.com/training/app-links/deep-linking) for Android._" (`https://auth0.com/docs/quickstart/native/ionic-angular/01-login`)

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

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 12, 2021, 7:32am UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/16 "2021-11-12T07:32:49Z")

</div>

Thanks for following up on that Gabriel!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 25, 2021, 12:36pm UTC](https://community.auth0.com/t/ionic-app-android-callback-problem-during-login/66868/17 "2021-11-25T12:36:58Z")

</div>


