You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you install the module with `nuxi module add`, it prompts you to generate `BETTER_AUTH_SECRET` and can append it to your `.env`. In CI/test environments it auto-generates the secret.
24
+
When you install the module with `nuxi module add`, it prompts you to generate `NUXT_BETTER_AUTH_SECRET` and can append it to your `.env`. `BETTER_AUTH_SECRET` still works as a compatibility fallback. In CI/test environments it auto-generates the secret.
25
25
::
26
26
27
27
Add these environment variables to `.env`:
@@ -31,7 +31,7 @@ Add these environment variables to `.env`:
31
31
The secret encrypts and hashes sensitive data. Must be at least 32 characters with high entropy.
32
32
33
33
```txt [.env]
34
-
BETTER_AUTH_SECRET=
34
+
NUXT_BETTER_AUTH_SECRET=
35
35
```
36
36
37
37
::generate-secret
@@ -44,7 +44,7 @@ openssl rand -base64 32
44
44
```
45
45
46
46
::tip
47
-
Prefix the variable with `NUXT_` to use Nuxt's runtime config system (recommended for multi-environment deployments): `NUXT_BETTER_AUTH_SECRET=`
47
+
Use `NUXT_BETTER_AUTH_SECRET` for Nuxt runtime config and multi-environment deployments. `BETTER_AUTH_SECRET` remains supported as a fallback.
Copy file name to clipboardExpand all lines: docs/content/3.guides/4.database-less-mode.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ See the official **Better Auth documentation** for database-less setup.
12
12
Database-less mode uses **JWE (JSON Web Encryption)** sessions. Instead of storing sessions in a database, the session data is encrypted and stored entirely in the cookie.
13
13
14
14
**How it works:**
15
-
- Session data is encrypted with your `BETTER_AUTH_SECRET`
15
+
- Session data is encrypted with your `NUXT_BETTER_AUTH_SECRET` (`BETTER_AUTH_SECRET` is also supported as a fallback)
16
16
- The encrypted token is stored in a cookie
17
17
- On each request, the server decrypts the cookie to get session data
18
18
- No database queries needed for session validation
### "BETTER_AUTH_SECRET must be at least 32 characters"
118
+
### "NUXT_BETTER_AUTH_SECRET must be at least 32 characters"
119
119
120
-
Your secret is too short. Generate a new one using the command above.
120
+
Your secret is too short. Generate a new one using the command above.`BETTER_AUTH_SECRET` is still accepted as a fallback, but `NUXT_BETTER_AUTH_SECRET` is the recommended variable.
thrownewError('[nuxt-better-auth] BETTER_AUTH_SECRET is required in production. Set BETTER_AUTH_SECRET or NUXT_BETTER_AUTH_SECRET environment variable.')
73
+
thrownewError('[nuxt-better-auth] NUXT_BETTER_AUTH_SECRET is required in production. Set NUXT_BETTER_AUTH_SECRET or BETTER_AUTH_SECRET environment variable.')
74
74
}
75
75
if(betterAuthSecret&&betterAuthSecret.length<32){
76
-
thrownewError('[nuxt-better-auth] BETTER_AUTH_SECRET must be at least 32 characters for security')
76
+
thrownewError('[nuxt-better-auth] NUXT_BETTER_AUTH_SECRET must be at least 32 characters for security')
consola.warn('[nuxt-better-auth] Skipping BETTER_AUTH_SECRET prompt (non-interactive). Set BETTER_AUTH_SECRET or NUXT_BETTER_AUTH_SECRET.')
49
+
consola.warn('[nuxt-better-auth] Skipping NUXT_BETTER_AUTH_SECRET prompt (non-interactive). Set NUXT_BETTER_AUTH_SECRET or BETTER_AUTH_SECRET.')
44
50
returnundefined
45
51
}
46
52
47
53
if(isCI||isTest){
48
54
constsecret=generateSecret()
49
55
appendSecretToEnv(rootDir,secret)
50
-
consola.info('Generated BETTER_AUTH_SECRET and added to .env (CI/test mode)')
56
+
consola.info('Generated NUXT_BETTER_AUTH_SECRET and added to .env (CI/test mode)')
51
57
returnsecret
52
58
}
53
59
54
-
consola.box('BETTER_AUTH_SECRET is required for authentication.\nThis will be appended to your .env file.')
60
+
consola.box('NUXT_BETTER_AUTH_SECRET is required for authentication.\nThis will be appended to your .env file.\nBETTER_AUTH_SECRET is still supported as a fallback.')
55
61
constchoice=awaitconsola.prompt('How do you want to set it?',{
0 commit comments