File tree Expand file tree Collapse file tree 3 files changed +37
-3
lines changed Expand file tree Collapse file tree 3 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -84,9 +84,12 @@ export default defineNuxtModule<VueFireNuxtModuleOptions>({
84
84
nuxt . options . runtimeConfig . public . vuefire . config = _options . config
85
85
nuxt . options . runtimeConfig . public . vuefire . appCheck = options . appCheck
86
86
87
+ // server only options
87
88
nuxt . options . runtimeConfig . vuefire ??= { }
88
89
markRaw ( nuxt . options . runtimeConfig . vuefire )
89
90
nuxt . options . runtimeConfig . vuefire . admin ??= options . admin
91
+ // allows getting the session cookie options
92
+ nuxt . options . runtimeConfig . vuefire . auth ??= options . auth
90
93
91
94
// configure transpilation
92
95
const { resolve } = createResolver ( import . meta. url )
@@ -173,8 +176,6 @@ export default defineNuxtModule<VueFireNuxtModuleOptions>({
173
176
addPluginTemplate ( {
174
177
src : normalize ( resolve ( templatesDir , 'plugin.ejs' ) ) ,
175
178
options : {
176
- // FIXME: not needed
177
- ...options ,
178
179
ssr : nuxt . options . ssr ,
179
180
} ,
180
181
} )
@@ -384,6 +385,12 @@ interface VueFireRuntimeConfig {
384
385
* @internal
385
386
*/
386
387
admin ?: VueFireNuxtModuleOptionsResolved [ 'admin' ]
388
+
389
+ /**
390
+ * Authentication options.
391
+ * @internal
392
+ */
393
+ auth ?: VueFireNuxtModuleOptionsResolved [ 'auth' ]
387
394
}
388
395
}
389
396
Original file line number Diff line number Diff line change @@ -71,7 +71,30 @@ export interface VueFireNuxtModuleOptions {
71
71
* permissions on your Google Cloud project. You can find more information about what happens behind the scenes
72
72
* in Firebase docs: [Manage Session Cookies](https://firebase.google.com/docs/auth/admin/manage-cookies).
73
73
*/
74
- sessionCookie ?: boolean
74
+ sessionCookie ?:
75
+ | boolean
76
+ | {
77
+ /**
78
+ * maxAge property of the cookie. Defaults to 5 days.
79
+ */
80
+ maxAge ?: number
81
+ /**
82
+ * Whether to use a secure cookie. Defaults to `true`.
83
+ */
84
+ secure ?: boolean
85
+ /**
86
+ * Whether to use a httpOnly cookie. Defaults to `true`.
87
+ */
88
+ httpOnly ?: boolean
89
+ /**
90
+ * The path of the cookie. Defaults to `/`.
91
+ */
92
+ path : string
93
+ /**
94
+ * The sameSite property of the cookie. Defaults to `lax`.
95
+ */
96
+ sameSite : 'lax' | 'strict' | 'none'
97
+ }
75
98
} & VueFireNuxtAuthDependencies )
76
99
77
100
/**
Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ export default defineEventHandler(async (event) => {
49
49
httpOnly : true ,
50
50
path : '/' ,
51
51
sameSite : 'lax' ,
52
+ // add user overrides
53
+ ...( typeof runtimeConfig . vuefire ?. auth ?. sessionCookie === 'object'
54
+ ? runtimeConfig . vuefire ?. auth ?. sessionCookie
55
+ : { } ) ,
52
56
} )
53
57
setResponseStatus ( event , 201 )
54
58
return ''
You can’t perform that action at this time.
0 commit comments