From ab09b007fe62c7664d009ec61449c23156f2c6e7 Mon Sep 17 00:00:00 2001 From: alexandresanchograca Date: Tue, 13 Aug 2024 12:48:20 +0100 Subject: [PATCH 1/2] Added a check to allow a option to do auth on client only during SSR. This is because we might want do SSR without server authentication, authentication only on the client, since many firestore data are not restricted by authorization or authentication of a user. --- packages/nuxt/src/module.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nuxt/src/module.ts b/packages/nuxt/src/module.ts index 9a17679a..b26c3f02 100644 --- a/packages/nuxt/src/module.ts +++ b/packages/nuxt/src/module.ts @@ -208,7 +208,9 @@ export default defineNuxtModule({ } // loads the user on the current app - addPlugin(resolve(runtimeDir, 'auth/plugin-authenticate-user.server')) + if(!options.auth.clientOnly){ + addPlugin(resolve(runtimeDir, 'auth/plugin-authenticate-user.server')) + } } // Emulators must be enabled after the app is initialized but before some APIs like auth.signinWithCustomToken() are called From 9ae28e0bf7e3a37809339c4cb2c1d4a1697bbc07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Gra=C3=A7a?= <96477074+alexandresanchograca@users.noreply.github.com> Date: Thu, 21 Nov 2024 09:23:45 +0000 Subject: [PATCH 2/2] Update packages/nuxt/src/module.ts Formatted code Co-authored-by: Daniel Kudwien --- packages/nuxt/src/module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nuxt/src/module.ts b/packages/nuxt/src/module.ts index b26c3f02..2381016d 100644 --- a/packages/nuxt/src/module.ts +++ b/packages/nuxt/src/module.ts @@ -208,7 +208,7 @@ export default defineNuxtModule({ } // loads the user on the current app - if(!options.auth.clientOnly){ + if (!options.auth.clientOnly) { addPlugin(resolve(runtimeDir, 'auth/plugin-authenticate-user.server')) } }