Skip to content

Commit 360f2dd

Browse files
docs(#1084): clarify originEnvKey usage (#1085)
* docs(#1084): clarify `originEnvKey` usage * docs: fix typo * Update docs/guide/application-side/configuration.md Co-authored-by: Zoey <zoeykaiser8@gmail.com> --------- Co-authored-by: Zoey <zoeykaiser8@gmail.com>
1 parent 522f41d commit 360f2dd

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

docs/guide/application-side/configuration.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@ Whether the module is enabled at all
3131
- **Type**: `string`
3232
- **Default**: `AUTH_ORIGIN`
3333

34-
The name of the environment variable that holds the origin of the application. This is used to determine the origin of your application in production.
34+
The name of the environment variable that holds the full base URL of the application. This is used to determine the base URL of your application in production.
3535

3636
By default, NuxtAuth will look at `AUTH_ORIGIN` environment variable and `runtimeConfig.authOrigin`.
3737

3838
::: tip
3939
If you want to use `runtimeConfig` and `NUXT_` prefixed environment variables, you need to make sure to also define the key inside `runtimeConfig`,
4040
because otherwise Nuxt will not acknowledge your env variable ([issue #906](https://github.com/sidebase/nuxt-auth/issues/906), read more [here](https://nuxt.com/docs/guide/going-further/runtime-config#environment-variables)).
4141

42-
```ts
42+
```ts [nuxt.config.ts]
4343
export default defineNuxtConfig({
4444
auth: {
45+
// NUXT_YOUR_ORIGIN=https://example.com/api/auth
4546
originEnvKey: 'NUXT_YOUR_ORIGIN'
4647
},
4748
runtimeConfig: {
@@ -51,7 +52,13 @@ export default defineNuxtConfig({
5152
```
5253
:::
5354

54-
You can read additional information on `origin` and `baseURL` determining [here](/resources/error-reference#auth-no-origin).
55+
::: warning
56+
Please note that despite the misleading name of "origin", this variable actually expects the **full** base URL, including the origin and pathname, e.g. `http://localhost:3000/api/auth`.
57+
58+
The configuration field name was chosen when the module relied on origins only. For better clarity the `originEnvKey` name will be deprecated in v1 and fully renamed in v2 in favor of a more speaking configuration.
59+
:::
60+
61+
You can read additional information on `baseURL` determining [here](../advanced/url-resolutions.md).
5562

5663
## `disableServerSideAuth`
5764

0 commit comments

Comments
 (0)