From ae549a3eb4bf1420f9e14601517a417ef729856a Mon Sep 17 00:00:00 2001 From: Fornazaric Florian Date: Mon, 25 Aug 2025 17:49:00 +0200 Subject: [PATCH] docs: share session data across multiple applications --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 1006f11f..329cdd75 100644 --- a/README.md +++ b/README.md @@ -737,6 +737,24 @@ await setUserSession(event, { ... } , { Checkout the [`SessionConfig`](https://github.com/unjs/h3/blob/c04c458810e34eb15c1647e1369e7d7ef19f567d/src/utils/session.ts#L20) for all options. +## Shared session between microservices and subdomains + +To share the same session between multiple hosted applications you can set and share the same `NUXT_SESSION_PASSWORD` + +If the applications are hosted on multiple subdomains, you also need to set the `cookie.domain` environment variable: + +```ts +{ + session: { + cookie: { + domain: '' + } + } +} +``` + +This will allow h3 to decode your session cookie across every applications + ## More - [nuxt-authorization](https://github.com/barbapapazes/nuxt-authorization): Authorization module for managing permissions inside a Nuxt app, compatible with `nuxt-auth-utils`