# Auth0 app ID doesn't link with the android application

**URL:** <https://community.auth0.com/t/auth0-app-id-doesnt-link-with-the-android-application/67288>\
**Category:** Get Help\
**Created:** [August 3, 2021, 11:07am UTC](https://community.auth0.com/t/auth0-app-id-doesnt-link-with-the-android-application/67288 "2021-08-03T11:07:39Z")\
**Posts on this page:** 8\
**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:** [August 3, 2021, 11:07am UTC](https://community.auth0.com/t/auth0-app-id-doesnt-link-with-the-android-application/67288/1 "2021-08-03T11:07:39Z")

</div>

Hi, we are trying to solve a problem with android application  
We are using Auth0, Capacitor and Ionic5 Angular.  
From our tests we understood that:

- In login page of the app we call the Auth0 correctly
- Auth0 perform the user login  
but we have a problem on callback (it’s seems that the Auth0 app ID doesn’t link with the android application)

The error is the following:  
E/Capacitor/Console: File: [https://re2n-dev.eu.auth0.com/authorize?redirect\_uri=io.rexulta.ionic.angular%3A%2F%2Fre2n-dev.eu.auth0.com%2Fcapacitor%2Fio.rexulta.ionic.angular%2Ftabs%2Fdashboard&client\_id=iOFWdNJiVOy6kxjfv9Djl2nJPyV416F1&audience=http%3A%2F%2Flocalhost%3A3001&appUri=http%3A%2F%2Flocalhost&scope=openid%20profile%20email&response\_type=code&response\_mode=web\_message&state=Mm5QaUVRWEdoLUJZbHpybmFub29oXzMzYXViWVB0cXQ0RHUxUnhsS29VYg%3D%3D&nonce=ZnA3MUZzTTJETlhYX21MRUJxSnU3MlJKSm5LR0psVVZxVXJER1ZKWXhETg%3D%3D&code\_challenge=uirWv\_vqXg7w6PVahKGIObSp2Fav7e5K1A-0vx3cXc0&code\_challenge\_method=S256&prompt=none&auth0Client=eyJuYW1lIjoiQGF1dGgwL2F1dGgwLWFuZ3VsYXIiLCJ2ZXJzaW9uIjoiMS41LjEifQ%3D%3D](https://re2n-dev.eu.auth0.com/authorize?redirect_uri=io.rexulta.ionic.angular%3A%2F%2Fre2n-dev.eu.auth0.com%2Fcapacitor%2Fio.rexulta.ionic.angular%2Ftabs%2Fdashboard&client_id=iOFWdNJiVOy6kxjfv9Djl2nJPyV416F1&audience=http%3A%2F%2Flocalhost%3A3001&appUri=http%3A%2F%2Flocalhost&scope=openid%20profile%20email&response_type=code&response_mode=web_message&state=Mm5QaUVRWEdoLUJZbHpybmFub29oXzMzYXViWVB0cXQ0RHUxUnhsS29VYg%3D%3D&nonce=ZnA3MUZzTTJETlhYX21MRUJxSnU3MlJKSm5LR0psVVZxVXJER1ZKWXhETg%3D%3D&code_challenge=uirWv_vqXg7w6PVahKGIObSp2Fav7e5K1A-0vx3cXc0&code_challenge_method=S256&prompt=none&auth0Client=eyJuYW1lIjoiQGF1dGgwL2F1dGgwLWFuZ3VsYXIiLCJ2ZXJzaW9uIjoiMS41LjEifQ%3D%3D) - Line 1 - Msg: Failed to execute ‘postMessage’ on ‘DOMWindow’: **The target origin provided (‘io.rexulta.ionic.angular://’) does not match the recipient window’s origin (‘[http://localhost](http://localhost)’).**

---

<div class="post-metadata">

**Author:** ![BetterAutomations](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/betterautomations/32/27490_2.png) [@BetterAutomations](https://community.auth0.com/u/BetterAutomations)\
**Post date:** [December 1, 2021, 8:23pm UTC](https://community.auth0.com/t/auth0-app-id-doesnt-link-with-the-android-application/67288/2 "2021-12-01T20:23:27Z")

</div>

Any luck with this? I am experiencing the same error.

---

<div class="post-metadata">

**Author:** ![avallete](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/avallete/32/35392_2.png) [@avallete](https://community.auth0.com/u/avallete)\
**Post date:** [July 4, 2022, 5:54pm UTC](https://community.auth0.com/t/auth0-app-id-doesnt-link-with-the-android-application/67288/3 "2022-07-04T17:54:49Z")

</div>

Anyone got lucky with this error ? I’m facing similar issue.

I’ve followed this guide to setup auth0 with capacitor: [Auth0 Ionic & Capacitor (React) SDK Quickstarts: Add login to your Ionic React with Capacitor app](https://auth0.com/docs/quickstart/native/ionic-react/interactive)

Everything is quite fine. I can login, logout. However, the issue seems to appears when the id\_token is expired, and auth0 try to obtain a new token based on what is actually present in the cache.

In that case, I see the same error, and it takes a few minutes before falling back to the auth0 login screen.

---

<div class="post-metadata">

**Author:** ![Alvaro948P4Q](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alvaro948p4q/32/40450_2.png) [@Alvaro948P4Q](https://community.auth0.com/u/Alvaro948P4Q)\
**Post date:** [October 6, 2022, 8:54am UTC](https://community.auth0.com/t/auth0-app-id-doesnt-link-with-the-android-application/67288/4 "2022-10-06T08:54:28Z")

</div>

Same here,

Originally the error was a HTTP 400 on /authorize with an entry on Auth0 logs:

```auto
The specified redirect_uri '<app_id>://<domain>/capacitor/<app_id>/callback' does not have a registered origin.

```

Then, and even thought the [documentation](https://auth0.com/docs/quickstart/native/ionic-angular/01-login#configure-origins) says to only configure:

```auto
capacitor://localhost, http://localhost

```

I also added the callback url to the allowed origins

```auto
<app_id>://<domain>/capacitor/<app_id>/callback

```

Now the error is:

```auto
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('<app_id>://') does not match the recipient window's origin

```

---

<div class="post-metadata">

**Author:** ![kormik](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kormik/32/25597_2.png) [@kormik](https://community.auth0.com/u/kormik)\
**Post date:** [October 14, 2022, 2:33pm UTC](https://community.auth0.com/t/auth0-app-id-doesnt-link-with-the-android-application/67288/5 "2022-10-14T14:33:54Z")

</div>

I am facing the same issue. Anyone knows what is the problem?

---

<div class="post-metadata">

**Author:** ![kormik](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kormik/32/25597_2.png) [@kormik](https://community.auth0.com/u/kormik)\
**Post date:** [October 20, 2022, 12:33pm UTC](https://community.auth0.com/t/auth0-app-id-doesnt-link-with-the-android-application/67288/7 "2022-10-20T12:33:20Z")

</div>

I found the problem (in my case). I was calling getTokeSilently() without any parameter. I added

```auto
getTokenSilently({
            redirect_uri: window.location.origin,
        })

```

Redirect url is actually not used for redirect but for checking origin (this should be documented).

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [October 20, 2022, 8:28pm UTC](https://community.auth0.com/t/auth0-app-id-doesnt-link-with-the-android-application/67288/8 "2022-10-20T20:28:59Z")

</div>

Hey @kormik good to know you were able to resolve the issue you were seeing!

It is a bit confusing, I am seeing `redirect_uri` as optional in our [docs](https://auth0.github.io/auth0-spa-js/interfaces/gettokensilentlyoptions.html), while at the same time the following:

> There’s no actual redirect when getting a token silently, but, according to the spec, a `redirect_uri` param is required. Auth0 uses this parameter to validate that the current `origin` matches the `redirect_uri` `origin` when sending the response. It must be whitelisted in the “Allowed Web Origins” in your Auth0 Application’s settings.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [December 22, 2022, 11:44pm UTC](https://community.auth0.com/t/auth0-app-id-doesnt-link-with-the-android-application/67288/9 "2022-12-22T23:44:58Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
