Skip to content

Commit

Permalink
docs: ssr and auth notes
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Sep 13, 2023
1 parent d988f13 commit c3d9eb5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 22 deletions.
17 changes: 0 additions & 17 deletions docs/cookbook/deployment-nuxt.md

This file was deleted.

7 changes: 6 additions & 1 deletion docs/nuxt/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ onMounted(() => {

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.

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).
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:

- Enable the IAM Service Account Credentials API on the [Google Cloud console](https://console.cloud.google.com/apis/api/iamcredentials.googleapis.com/overview).
- Once activated, add a _specific role_ to your service account. Find the details in [the Firebase documentation](https://firebase.google.com/docs/auth/admin/create-custom-tokens#iam_api_not_enabled).

Some projects do not need to render pages with different permissions based on the user. In that case, you can disable the session cookie by setting `sessionCookie` to `false` in `nuxt.config.ts`:

```ts{7}
export default defineNuxtConfig({
Expand Down
4 changes: 1 addition & 3 deletions docs/nuxt/deployment.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Deployment

> This section is a work in progress.
Given the amount of steps needed to fully provision a Firebase Project, you can directly use these templates instead:

- [Spark Plan](https://github.com/posva/nuxt--vuefire-example-spark-plan)
Expand Down Expand Up @@ -35,7 +33,7 @@ The Blaze plan is a pay-as-you-go that allows you to run Firebase Functions. **I
NITRO_PRESET=firebase nuxt build
```

alternatively, you can use the `nitro.preset` option in your `nuxt.config.ts`, which will only be applied during builds.
Alternatively, you can use the `nitro.preset` option in your `nuxt.config.ts`, which will only be applied during builds.

```ts{3}
export default defineNuxtConfig({
Expand Down
2 changes: 1 addition & 1 deletion docs/nuxt/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Nuxt VueFire works both with and without SSR. You don't need to do anything special to make it work with SSR, everything is handled automatically.

You can read more about SSR in the [VueFire SSR page](../guide/ssr)
You can read more about SSR and VueFire in general in the [VueFire SSR page](../guide/ssr)

0 comments on commit c3d9eb5

Please sign in to comment.