Skip to content

Commit 31d04ea

Browse files
committed
docs(#1078): update error reference page
1 parent 0ee41e7 commit 31d04ea

2 files changed

Lines changed: 11 additions & 25 deletions

File tree

docs/guide/advanced/url-resolutions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default defineNuxtConfig({
9999
})
100100
```
101101

102-
```env diff [.env]
102+
```dotenv diff [.env]
103103
AUTH_ORIGIN="https://my-backend.com/api/auth" // [!code ++]
104104
```
105105

docs/resources/error-reference.md

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Error and warnings
1+
# Errors and warnings
22

33
This is a list of errors & warnings that NuxtAuth throws, what each of them means and how you can resolve them.
44

@@ -11,7 +11,7 @@ This is a list of errors & warnings that NuxtAuth throws, what each of them mean
1111
import { NuxtAuthHandler } from '#auth'
1212

1313
export default NuxtAuthHandler({
14-
secret: 'my-superb-secret' // <--- !!!! THIS IS WHAT'S MISSING
14+
secret: 'my-superb-secret', // This is missing // [!code ++]
1515

1616
// ... rest of your config
1717
})
@@ -22,33 +22,19 @@ export default NuxtAuthHandler({
2222
`AUTH_NO_ORIGIN` will appear as a warning message during development and be thrown as an error that stops the application during production.
2323
It is safe to ignore the development warning - it is only meant as a heads-up for your later production-deployment.
2424

25-
`AUTH_NO_ORIGIN` occurs when the origin of your application was not set.
26-
NuxtAuth attempts to find the origin of your application in the following order ([source](https://github.com/sidebase/nuxt-auth/blob/9852116a7d3f3be56f6fdc1cba8bdff747c4cbb8/src/runtime/server/services/utils.ts#L8-L34)):
25+
`AUTH_NO_ORIGIN` occurs when the authentication base URL of your application was not set.
2726

28-
### 1. Environment variable and `runtimeConfig`
27+
For a detailed guide on pathing logic, refer to its [dedicated page](../guide/advanced/url-resolutions.md).
2928

30-
Use the `AUTH_ORIGIN` environment variable or `runtimeConfig.authOrigin` if set. Name can be customized, refer to [`originEnvKey`](/guide/application-side/configuration#originenvkey).
29+
The simplest way to fix this error is by providing `auth.baseUrl` in your `nuxt.config.ts`:
3130

32-
### 2. `baseURL`
33-
34-
The `origin` is computed using `ufo` from the provided `baseURL`. See implementation [here](https://github.com/sidebase/nuxt-auth/blob/9852116a7d3f3be56f6fdc1cba8bdff747c4cbb8/src/runtime/helpers.ts#L9-L23).
35-
36-
```ts
31+
```ts [nuxt.config.ts]
3732
export default defineNuxtConfig({
3833
auth: {
39-
baseURL: `http://localhost:${process.env.PORT || 3000}`
40-
}
34+
baseUrl: 'https://example.com/api/auth', // [!code ++]
35+
},
36+
// ... other configuration
4137
})
4238
```
4339

44-
### 3. Development only: automatically from the incoming HTTP request
45-
46-
When the server is running in development mode, NuxtAuth can automatically infer it from the incoming request.
47-
48-
::: info
49-
This is only done for your convenience - make sure to set a proper origin in production.
50-
:::
51-
52-
---
53-
54-
If there is no valid `origin` after the steps above, `AUTH_NO_ORIGIN` error is thrown in production.
40+
For setting your authentication base URL dynamically, refer to [Changing `baseURL`](../guide/advanced/url-resolutions.md#changing-baseurl).

0 commit comments

Comments
 (0)