# Capacitor/Ionic Example not working

**URL:** <https://community.auth0.com/t/capacitor-ionic-example-not-working/130720>\
**Category:** Get Help\
**Tags:** classic-universal-login-experience, login-experience\
**Created:** [March 28, 2024, 2:12pm UTC](https://community.auth0.com/t/capacitor-ionic-example-not-working/130720 "2024-03-28T14:12:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![claptimes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/claptimes/32/17932_2.png) [@claptimes](https://community.auth0.com/u/claptimes)\
**Post date:** [March 28, 2024, 2:12pm UTC](https://community.auth0.com/t/capacitor-ionic-example-not-working/130720/1 "2024-03-28T14:12:13Z")

</div>

I’m trying to get the Capacitor example app to work in the iOS simulator. I can see the auth0 login page, but when I click “sign-in” or after I’ve already completed the login, I can’t get the handleRedirectCallback to work correctly.

I’ve downloaded the [sample code](https://auth0.com/docs/quickstart/native/ionic-react/01-login), updated my auth0 app config.

I’ve added the console log statements so you can see where the issue is in the example code. I can see the “Before callback” statement in the xcode log, but not the “after callback”.

```auto
    CapApp.addListener("appUrlOpen", async ({ url }) => {
      if (url.startsWith(callbackUri)) {
        if (
          url.includes("state") &&
          (url.includes("code") || url.includes("error"))
        ) {
          console.log('Before callback')
          await handleRedirectCallback(url);
          console.log('After callback')
        }

        await Browser.close();
      }
    });
  }, [handleRedirectCallback]);

```

 ![blank iphone screen](https://global.discourse-cdn.com/auth0/original/3X/0/7/077998c352e598f2a7aa9a759883e8185337f9f2.png)

Using Xcode: 15.3  
Macos: Sonoma: 14.4.1

---

<div class="post-metadata">

**Author:** ![claptimes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/claptimes/32/17932_2.png) [@claptimes](https://community.auth0.com/u/claptimes)\
**Post date:** [March 28, 2024, 2:30pm UTC](https://community.auth0.com/t/capacitor-ionic-example-not-working/130720/2 "2024-03-28T14:30:13Z")

</div>

This was a CORS issue. I fixed it by adding

`capacitor://localhost, http://localhost` to my auth0 app config under “Allow Cross-Origin Authentication”

---

<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:** [April 11, 2024, 2:30pm UTC](https://community.auth0.com/t/capacitor-ionic-example-not-working/130720/3 "2024-04-11T14:30:34Z")

</div>

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