nuxt-auth icon indicating copy to clipboard operation
nuxt-auth copied to clipboard

replace auth origin in runtime to enable usage with cloudlfare tunnels

Open Niki2k1 opened this issue 1 year ago • 3 comments

Describe the feature

Currently this lib does not work with the inbuilt nuxi dev --tunnel dev environment. Thats because the library needs to know the origin of the page.

I already tried getting the tunnel url with a hook like this:

nuxt.hook('listen', async (_listenerServer, listener) => {
  const urls: ListenerURL[] = await listener.getURLs();
  const tunnelUrl = urls.find((url) => url.type === 'tunnel');

  if (tunnelUrl) {
    nuxt.options.runtimeConfig.baseURL = tunnelUrl.url; // <---- this does not seem to work
  }
});

But replacing the url at runtime does not seem to work.

Input would be appreciated, I could try to make an PR then.

Additional information

No response

Niki2k1 avatar Feb 02 '24 21:02 Niki2k1

Hi @Niki2k1 👋

As we are currently working on the rewrite to using authjs under the hood (which does work for cloudflare), I would therefore not prioritize this issue, as it may be resolved by https://github.com/sidebase/nuxt-auth/issues/673!

zoey-kaiser avatar Mar 04 '24 22:03 zoey-kaiser

@zoey-kaiser thats awesome, I'll check again when the rewrite to authjs is done.

Niki2k1 avatar Mar 05 '24 07:03 Niki2k1

@Niki2k1 You can patch the source code to make it work while we wait for a new version. https://github.com/sidebase/nuxt-auth/issues/691#issuecomment-1971226750

DavidDeSloovere avatar Mar 14 '24 10:03 DavidDeSloovere