Capacitor/Ionic Example not working

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, 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”.

    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]);

Using Xcode: 15.3
Macos: Sonoma: 14.4.1

This was a CORS issue. I fixed it by adding

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

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