Skip to content

Commit 2fd2830

Browse files
committed
docs(nuxt): update auth config
1 parent 9af5c99 commit 2fd2830

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

docs/nuxt/auth.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
Nuxt VueFire integrates with [Firebase Authentication](https://firebase.google.com/docs/auth) module to automatically synchronize the current user state on the server and the client. Activate this module by setting the `vuefire.auth` to `true` in `nuxt.config.ts`:
44

5-
```ts{5}
5+
```ts{5-7}
66
export default defineNuxtConfig({
77
// ...
88
vuefire: {
99
// ensures the auth module is enabled
10-
auth: true,
10+
auth: {
11+
enabled: true
12+
},
1113
config: {
1214
// ...
1315
}
@@ -74,3 +76,22 @@ onMounted(() => {
7476
})
7577
</script>
7678
```
79+
80+
## Session Cookie
81+
82+
When doing SSR and if a service account is provided, Nuxt VueFire automatically mints a cookie when the user logs in. This cookie is passed to each request and allows the server to authenticate the user while rendering the page, limiting what the user can see based on their permissions.
83+
84+
In order to use this feature, you must provide a service account and ensure you have the correct permissions set in your Google Cloud project. I recommend you to take a look at [this template and its instructions to setup Authentication](https://github.com/posva/nuxt--vuefire-example-blaze-plan#authentication).
85+
86+
```ts{7}
87+
export default defineNuxtConfig({
88+
// ...
89+
vuefire: {
90+
// ensures the auth module is enabled
91+
auth: {
92+
enabled: true
93+
sessionCookie: true
94+
},
95+
},
96+
})
97+
```

docs/nuxt/getting-started.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,14 @@ echo service-account.json >> .gitignore
8686

8787
If you are using the [Authentication](https://firebase.google.com/docs/auth) module or [AppCheck](https://firebase.google.com/docs/app-check#web), make sure to enable them as well:
8888

89-
```ts{5,6-13}
89+
```ts{5-7,8-13}
9090
export default defineNuxtConfig({
9191
// ...
9292
vuefire: {
9393
// ensures the auth module is enabled
94-
auth: true,
94+
auth: {
95+
enabled: true
96+
},
9597
appCheck: {
9698
// Allows you to use a debug token in development
9799
debug: process.env.NODE_ENV !== 'production',

0 commit comments

Comments
 (0)