# Auth0 callback URL with Capacitor native app?

**URL:** <https://community.auth0.com/t/auth0-callback-url-with-capacitor-native-app/66293>\
**Category:** Get Help\
**Tags:** auth0-spa-js, capacitor, native\
**Created:** [July 16, 2021, 2:50pm UTC](https://community.auth0.com/t/auth0-callback-url-with-capacitor-native-app/66293 "2021-07-16T14:50:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SpinUp](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/spinup/32/12714_2.png) [@SpinUp](https://community.auth0.com/u/SpinUp)\
**Post date:** [July 16, 2021, 2:50pm UTC](https://community.auth0.com/t/auth0-callback-url-with-capacitor-native-app/66293/1 "2021-07-16T14:50:43Z")

</div>

Hi there,

I hope someone can help. I’m struggling to find any information about what the callback URL would be for a native app deployed using Capacitor.

I’ve seen some discussion about Ionic using ionic://, but we’re not using Capacitor with that.

I found one post that said to use capacitor://… but that never triggers going back to the app.

There’s a login “popup” option, but that doesn’t show the popup in the app

I’m still testing using the Android Simulator, so not sure if that’s part of the issue?

Has anyone managed to deploy a Capacitor / auth0 app without Ionic and get the redirect to work?

I’m using the auth0 SPA JS library.

Hope you can help!

Martin

---

<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, 4:46pm UTC](https://community.auth0.com/t/auth0-callback-url-with-capacitor-native-app/66293/2 "2021-10-15T16:46:10Z")

</div>

I’m working on a similar thing, so I can share with you my solution.

But first, check out [https://capacitorjs.com/docs/apis/app](https://capacitorjs.com/docs/apis/app) for more detail.

To use a custom URL scheme on android,

1. In `android/app/src/main/AndroidManifest.xml`, inside the activity section, add the following:

```xml
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="@string/custom_url_scheme" />
</intent-filter>

```

1. Then in `android/app/src/main/res/values/strings.xml`, change the value of `custom_url_scheme` to your custom scheme.

2. Finally in `android/app/src/main/res/xml/config.xml`, add the following at root so that only one instance of your app will be ever be launched and therefore after authentication the callback will always be delivered to the right app.

```xml
<preference name="AndroidLaunchMode" value="singleTask" />

```

---

<div class="post-metadata">

**Author:** ![SpinUp](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/spinup/32/12714_2.png) [@SpinUp](https://community.auth0.com/u/SpinUp)\
**Post date:** [October 20, 2021, 10:47am UTC](https://community.auth0.com/t/auth0-callback-url-with-capacitor-native-app/66293/3 "2021-10-20T10:47:58Z")

</div>

Thanks @alvis !

A combination of what you wrote and these docs to help get the right callback URL helped: [Auth0 Ionic & Capacitor (React) SDK Quickstarts: Login](https://auth0.com/docs/quickstart/native/ionic-react/01-login)

This was my callback URL:  
[APP\_ID]://[AUTH0\_TENANT].eu.auth0.com/capacitor/[APP\_ID]/callback

Where the APP\_ID is usually the website domain backwards.

Then using your code where the custom\_url\_scheme is the website domain (not backwards) to allow the auth0 redirect / callback to open in Capacitor.

---

<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:** [October 20, 2021, 11:28am UTC](https://community.auth0.com/t/auth0-callback-url-with-capacitor-native-app/66293/4 "2021-10-20T11:28:41Z")

</div>

Teamwork makes the dreamwork!

---

<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:** [October 28, 2021, 12:58pm UTC](https://community.auth0.com/t/auth0-callback-url-with-capacitor-native-app/66293/5 "2021-10-28T12:58:35Z")

</div>


