Skip to content

Commit 72f7e39

Browse files
committed
Finished 0.10.0 upgrade guide
1 parent d230df1 commit 72f7e39

File tree

1 file changed

+74
-14
lines changed

1 file changed

+74
-14
lines changed

docs/upgrade/version-0.10.0.md

Lines changed: 74 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,81 @@ definePageMeta({
4343

4444
### Adjustments to the computation of `baseURL` and `AUTH_ORIGIN`
4545

46-
In 0.10.0 we spent a considerable amount of time reworking how @sidebase/nuxt-auth determine which endpoints to make requests to. If you would like to view the full PR and discussion, you can find it [here](https://github.com/sidebase/nuxt-auth/pull/913).
46+
In 0.10.0 we spent a considerable amount of time reworking how `@sidebase/nuxt-auth` determine which endpoints to make requests to. If you would like to view the full PR and discussion, you can find it [here](https://github.com/sidebase/nuxt-auth/pull/913).
4747

48-
As a quick overview, @sidebase/nuxt-auth will now use the following logic to determine where to make requests to:
49-
-
48+
As a quick overview, `@sidebase/nuxt-auth` will now use the following logic to determine where to make requests to:
49+
50+
#### 1. Environment variable and `runtimeConfig`
51+
52+
Use the `AUTH_ORIGIN` environment variable or `runtimeConfig.authOrigin` if set. Name can be customized, refer to [`originEnvKey`](/guide/application-side/configuration#originenvkey).
53+
54+
#### 2. `baseURL`
55+
56+
Use the static [`baseURL`](/guide/application-side/configuration#baseurl) inside the `nuxt.config.ts` if set.
57+
58+
#### 3. Automatically from the incoming `HTTP` request
59+
60+
When the server is running in **development mode**, NuxtAuth can automatically infer it from the incoming request.
61+
62+
---
63+
64+
Therefore as of version 0.10.0, we recommend the following setup to set your `AUTH_ORIGIN` or `baseURL`:
65+
66+
::: code-group
67+
68+
```ts diff [nuxt.config.ts]
69+
export default defineNuxtConfig({
70+
// ...Previous configuration
71+
runtimeConfig: { // [!code ++]
72+
baseURL: '/api/auth' // [!code ++]
73+
}, // [!code ++]
74+
auth: {
75+
baseUrl: 'https://my-backend.com/api/auth', // [!code --]
76+
originEnvKey: 'NUXT_BASE_URL', // [!code ++]
77+
}
78+
})
79+
```
80+
81+
```env diff [.env]
82+
NUXT_BASE_URL="https://my-backend.com/api/auth" // [!code ++]
83+
```
84+
85+
:::
86+
87+
### Adjustments when using an external backend for the `local`-provider
88+
89+
In previous versions of `@sidebase/nuxt-auth` a very specific setup was needed to ensure that external backends could properly be used for the `local`-provider. In 0.10.0 we reworked the internal handling or urls to make it more consistent across providers and configurations.
90+
91+
If you were previously using an external backend you can now make the following adjustments:
92+
93+
```ts diff
94+
export default defineNuxtConfig({
95+
auth: {
96+
provider: {
97+
type: 'local',
98+
endpoints: {
99+
signIn: { path: 'login', method: 'post' }, // [!code --]
100+
signIn: { path: '/login', method: 'post' }, // [!code ++]
101+
getSession: { path: 'session', method: 'get' }, // [!code --]
102+
getSession: { path: '/session', method: 'get' }, // [!code ++]
103+
}
104+
}
105+
}
106+
})
107+
```
108+
109+
You can find a full overview of how `@sidebase/nuxt-auth`handles urls [here](https://github.com/sidebase/nuxt-auth/pull/913#issuecomment-2359137989).
50110

51111
## Changelog
52112

53-
* fix(#834): Do not refresh on window focus for unprotected pages by @YoshimiShima in https://github.com/sidebase/nuxt-auth/pull/858
54-
* chore: add metadata fields to package.json by @MuhammadM1998 in https://github.com/sidebase/nuxt-auth/pull/864
55-
* fix(#860): make node version requirement less strict by @phoenix-ru in https://github.com/sidebase/nuxt-auth/pull/865
56-
* docs: Add recipes section and copy old recipes by @zoey-kaiser in https://github.com/sidebase/nuxt-auth/pull/868
57-
* chore: add plausible site analytics by @zoey-kaiser in https://github.com/sidebase/nuxt-auth/pull/869
58-
* feat(#673, #523, #848): back-port authjs migration by @phoenix-ru in https://github.com/sidebase/nuxt-auth/pull/849
59-
* feat(#821): Unify `local` and `refresh` providers into one by @zoey-kaiser in https://github.com/sidebase/nuxt-auth/pull/822
60-
* chore: updated ESLint and general housekeeping by @zoey-kaiser in https://github.com/sidebase/nuxt-auth/pull/853
61-
* chore: update docs for `0.9.0` by @zoey-kaiser in https://github.com/sidebase/nuxt-auth/pull/873
62-
63-
**Full Changelog**: https://github.com/sidebase/nuxt-auth/compare/0.8.2...0.9.0
113+
* docs(fix): use correct process env variable for baseUrl by @felixranesberger in https://github.com/sidebase/nuxt-auth/pull/940
114+
* enh(#895): Custom refresh response token pointer by @Rizzato95 in https://github.com/sidebase/nuxt-auth/pull/910
115+
* feat(#797, #878): set `baseURL` via environment variables and improve internal url detection by @zoey-kaiser in https://github.com/sidebase/nuxt-auth/pull/913
116+
* chore(#892): rename middleware to avoid conflicts by @zoey-kaiser in https://github.com/sidebase/nuxt-auth/pull/957
117+
* enh(#935): allow external login page by @Thomas-Philippot in https://github.com/sidebase/nuxt-auth/pull/936
118+
* release: 0.10.0-rc.1 by @zoey-kaiser in https://github.com/sidebase/nuxt-auth/pull/958
119+
* chore: upgrade to nitro 2.10, preparing for nitropack ecosystem switch from `nitropack` to `nitro` by @BracketJohn in https://github.com/sidebase/nuxt-auth/pull/942
120+
* fix(#927): fix the warnings produced by Nuxt when awaiting runtime config by @phoenix-ru in https://github.com/sidebase/nuxt-auth/pull/959
121+
* release: 0.10.0-rc.2 by @zoey-kaiser in https://github.com/sidebase/nuxt-auth/pull/960
122+
123+
**Full Changelog**: https://github.com/sidebase/nuxt-auth/compare/0.9.4...0.10.0

0 commit comments

Comments
 (0)