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

Load `baseURL` from runtime config

Open cngJo opened this issue 1 year ago • 1 comments

Describe the feature

I usually have my API base URL for external APIs in:

  runtimeConfig: {
    public: {
      apiBaseUrl: 'https://my-awesome-backend.local'
    }
  },

and replicate it in nuxt-auth config

baseURL: process.env.NUXT_PUBLIC_API_BASE_URL ?? "https://my-awesome-backend.local",

But then I need the NUXT_PUBLIC_API_BASE_URL variable on build and runtime, which is a bit annoying.

Therefore, it would be awesome to specify a JSON pointer to runtime config like it's done for the access / refresh tokens.

How would you implement this?

No response

Additional information

  • [X] Would you be willing to help implement this feature?

Provider

  • [X] AuthJS
  • [X] Local
  • [X] Refresh
  • [ ] New Provider

cngJo avatar Aug 23 '24 07:08 cngJo

Maybe related to #797

cngJo avatar Aug 23 '24 16:08 cngJo

You can now set baseURL using

runtimeConfig: {
  public: {
    auth: {
      baseURL: 'https://example.com/your/base/url'
    }
  }
}

as well as via originEnvKey and auth.baseURL

phoenix-ru avatar Dec 12 '24 17:12 phoenix-ru

Done in #913

phoenix-ru avatar Dec 12 '24 17:12 phoenix-ru