quasar-dev localhost for capacitor apps
-
Currently, the quasar-dev library overtly translates the host designation of “localhost” to the an IP address (invoking getExternalIP() and displaying “
️ Detected external IP xxx.xxx.xxx.xxx and using it” on startup). I’m not entirely sure what the thought process is behind the business logic as “localhost”, “127.0.0.1”, “0.0.0.0”, and “::1” are all translated to IP address.
The problem is, as best I can tell, it isn’t possible to run a Capacitor app in dev mode using a dynamically allocated IP when invoking Google OAuth. Google OAuth requires whitelisting a source to allow the auth call to function. Failure to do so induces the error “Not a valid origin for the client: http://xxx.xxx.xxx.xxx:yyyy has not been whitelisted for client ID zzz.apps.googleusercontent.com. Please go to https://console.developers.google.com/ and whitelist this origin for your project’s client ID.” IPs are not acceptable in the whitelist section and a variety of workarounds do not appear to help. However, forcing the host to “localhost” without translating to an IP address and adding “http://localhost” to the Google OAuth whitelist works perfectly. Unfortunately, this required a hack of the quasar-dev codebase on my part.
What I’m suggesting is that there should be a simple way to force Capacitor to use “localhost”.
Thoughts?
-
@aitcheyejay said in quasar-dev localhost for capacitor apps:
Unfortunately, this required a hack of the quasar-dev codebase on my part.
could you share this ‘hack’?
-
I think the IP is required for hot loading. However, I do think there’s a need to be able to assume a domain or localhost to make a Google OAuth whitelist work. Tried a bunch of approaches without any luck.
Perhaps this is just a need to work out Google OAuth whitelisting in dev mode.
-
@aitcheyejay , can you share the hack?