# Using App Links for React Native Auth0 on Android

**URL:** <https://community.auth0.com/t/using-app-links-for-react-native-auth0-on-android/185570>\
**Category:** Dev to Dev Hub\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [April 16, 2025, 12:11pm UTC](https://community.auth0.com/t/using-app-links-for-react-native-auth0-on-android/185570 "2025-04-16T12:11:45Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmerch](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rmerch/32/71550_2.png) [@rmerch](https://community.auth0.com/u/rmerch)\
**Post date:** [April 16, 2025, 12:11pm UTC](https://community.auth0.com/t/using-app-links-for-react-native-auth0-on-android/185570/1 "2025-04-16T12:11:45Z")

</div>

### Issue Summary

We recently go pen tested and one of the major issues the tester discovered was they was able to hijack the apps scheme and get hold of an access token via another app. This is only possible on Android. The suggested fix for this was to use a registered domain rather that the bundle id in the redirect URL.

I’ve set up a domain and have associated it with the app and this all works fine. I’m able to use the domain and it opens the app.

My issue is I’m unable to get the redirect to work.

- **Expected:** When I log in, I expect the app to open and the auth flow to continue in the same way when using the bundle id in the redirect.
- **Actual:** The call back opens the app but I receive an error message `The browser window was closed by a new instance of the application`.

### Steps to Reproduce if necessary

1. Setup the Android app according to the docs, setting the `auth0Domain` and `auth0Scheme` in the `defaultConfig`.
2. Add the callback and login out URL as instructed in the documentation.
3. Add the extra callbacks for the domain, using this structure `https://example.com://{AUTH0_DOMAIN}/android/{PRODUCT_BUNDLE_IDENTIFIER}/callback`
4. Add the `customScheme` to the `authorize` hook. (`https://example.com`)

### Error / Debug Info

- The browser window was closed by a new instance of the application

**- Note: Remove or obfuscate any sensitive info (emails, tenant names, API keys, etc.) before posting.**

### Environment

- **Platform:** (React Native - Android)
- **SDK/Library:** (auth0-react-navive v4.4.0)
- **Versions:** (e.g., React Native 0.75.4, Node.js v22.9.0, )

### Additional Context

- I’m using React Navigation to handle deep linking and I have added the domain as a prefix in the linking property of the Navigation Container. I’ve also configured the `getInitialURL` and `subscribe` functions. When auth0 redirect back to the app, I log the URL in both the `getInitialURL` and `subscribe` functions. `getInitialURL` returns null from `Linking.getInitialURL()`. But the `Linking.addEventListener` in the `subscribe` function returns `https://example.com//{AUTH0_DOMAIN}/android/{PRODUCT_BUNDLE_IDENTIFIER}/callback?code=-{CODE}&state={STATE}`

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 1, 2025, 1:00am UTC](https://community.auth0.com/t/using-app-links-for-react-native-auth0-on-android/185570/4 "2025-05-01T01:00:00Z")

</div>

Hi @rmerch,

Welcome to the Auth0 Community!

Firstly, thank you for bringing this to our attention.

Let me look into this and get back to you shortly with an update.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 1, 2025, 8:34pm UTC](https://community.auth0.com/t/using-app-links-for-react-native-auth0-on-android/185570/5 "2025-05-01T20:34:16Z")

</div>

Hi @rmerch,

I see you have contacted our Developer Support Team directly about this issue and opened a case.

At the moment, our engineering team is investigating the vulnerability you mentioned.

Once there’s an update, I will follow up on this thread.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![rmerch](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rmerch/32/71550_2.png) [@rmerch](https://community.auth0.com/u/rmerch)\
**Post date:** [May 6, 2025, 8:19am UTC](https://community.auth0.com/t/using-app-links-for-react-native-auth0-on-android/185570/6 "2025-05-06T08:19:36Z")

</div>

Hi @rueben.tiow, thanks for responding. That’s correct, our security engineer has reached out for support. I will likely close this for now and handle this issue through our support channel.

If we resolve this, it maybe worth updating the docs as I’m sure we are not the only ones facing this issue.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 6, 2025, 11:07pm UTC](https://community.auth0.com/t/using-app-links-for-react-native-auth0-on-android/185570/7 "2025-05-06T23:07:26Z")

</div>

Hi @rmerch,

Thanks for the update.

Certainly, I can pass the feedback to our docs teams about this.

If anything else comes up, please feel free to reach out again.

Best regards,  
Rueben

---

<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:** [May 20, 2025, 11:08pm UTC](https://community.auth0.com/t/using-app-links-for-react-native-auth0-on-android/185570/8 "2025-05-20T23:08:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![remus.ivan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/remus.ivan/32/68771_2.png) [@remus.ivan](https://community.auth0.com/u/remus.ivan)\
**Post date:** [September 5, 2025, 8:40pm UTC](https://community.auth0.com/t/using-app-links-for-react-native-auth0-on-android/185570/9 "2025-09-05T20:40:12Z")

</div>



---

<div class="post-metadata">

**Author:** ![sugaith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sugaith/32/77588_2.png) [@sugaith](https://community.auth0.com/u/sugaith)\
**Post date:** [November 25, 2025, 12:18am UTC](https://community.auth0.com/t/using-app-links-for-react-native-auth0-on-android/185570/10 "2025-11-25T00:18:18Z")

</div>

Hey, is this solved?

I’m having this on version `^5.1.0`

The webview triggers the callback before the process is over, opening the App again.

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [December 2, 2025, 7:20pm UTC](https://community.auth0.com/t/using-app-links-for-react-native-auth0-on-android/185570/11 "2025-12-02T19:20:52Z")

</div>

Hi @sugaith

Welcome to the Auth0 Community!

What is the exact issue that you are experiencing in your application? Also, did you have the chance to take a look at the documentation available on the [Github](https://github.com/auth0/react-native-auth0?tab=readme-ov-file#app-link-recommended) page?

There is a new version for the SDK at this time, which is 5.2.0. Does upgrading your environment fix the issue?

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![sugaith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sugaith/32/77588_2.png) [@sugaith](https://community.auth0.com/u/sugaith)\
**Post date:** [December 9, 2025, 12:19am UTC](https://community.auth0.com/t/using-app-links-for-react-native-auth0-on-android/185570/12 "2025-12-09T00:19:26Z")

</div>

Hey there, thanks for your prompt response.

Upon opening the webView, I encountered the exact same error (only on Android, it worked on iOS).

The error message was: “The browser window was closed by a new instance of the application.”

I’m using Expo 54, and in `app.config.ts`, there are two types of schemes: Expo’s scheme and react-native-auth0’s custom-scheme.

On iOS, it works if we use the same Expo scheme for both, but for Android, they need to be different (or else, the webView will open another instance of the app when triggering the callback)

Here’s the code snippet (app.config.ts):

```auto
scheme: SOME_SCHEME, // expo scheme
puglins: [
[
  ‘react-native-auth0’,
  {
    domain: process.env.EXPO_PUBLIC_AUTH0_DOMAIN,

    customScheme: process.env.EXPO_PUBLIC_AUTH0_SCHEME, // This is where we set the custom-scheme (according to the docs, auth0 recommends the app's bundleID or packageId as a custom scheme, but it can also be another one as long as it’s added to the callback and logout list)

  },
]]

```

If not for this error, the callback for mobile could be as simple as `SOME_SCHEME://anyPath` (with the App’s original scheme)
