Angular Capacitor Production Support

The Production Check fails when trying to use Capacitor origins as Allowed Origins (CORS)
Capacitor apps are configured to use http://localhost and capacitor://localhost as their origins, as seen in auth0 guide: Auth0 Ionic & Capacitor (Angular) SDK Quickstarts: Login

But its fails to publish/pass the pre-production check due to:
Allowed Origins (CORS) is not Localhost

Validate that the Location URL for the page does not point to localhost.

1/2 Applications failed.

ERROR DETAILS

  • My App: The following location URLs are using localhost: "capacitor://localhost, http://localhost"

I’m using @auth0/auth0-angular, the only solution I can think of, other than Auth0 allowing these origins in production, is to use a plugin Capacitor Http Plugin API | Capacitor Documentation to bypass the CORS requirements. Is there any way to configure the sdk to use this plugin or any other solutions, please advise?

After reviewing some documents, there are a couple of way to workaround this such as modifying the origin used by capacitor via the config’s server setting. Otherwise there is also a opt in support in the config to override fetch with native requests bypassing CORS, so no need to use a plugin.

1 Like

Glad you have figured it out and thanks for sharing with the rest of community!

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