You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Supabase 'service role key', has super admin rights and can bypass your Row Level Security.
83
86
84
-
85
87
### `redirect`
86
88
87
89
Default: `true`
88
90
89
91
Redirect automatically to the configured login page if a non authenticated user is trying to access a guarded. You can disable all redirects by setting this option to false.
90
92
91
-
92
93
### `redirectOptions`
93
94
94
95
Default:
@@ -101,10 +102,11 @@ Default:
101
102
cookieRedirect: false,
102
103
}
103
104
```
104
-
- `login`: User will be redirected to this path if not authenticated or after logout.
105
+
106
+
- `login`: User will be redirected to this path if not authenticated or after logout.
105
107
- `callback`: This is the path the user will be redirect to after supabase login redirection. Should match configured `redirectTo` option of your [signIn method](https://supabase.com/docs/reference/javascript/auth-signinwithoauth). Should also be configured in your Supabase dashboard under `Authentication->URLConfiguration->RedirectURLs`.
106
108
- `exclude`: Routes to exclude from the redirect. `['/foo', '/bar/*']` will exclude the `foo` page and all pages in your `bar` folder.
107
-
- `cookieRedirect`: Sets a cookie containing the path an unauthenticated user tried to access. The cookie can then be used on the [`/confirm`](https://supabase.nuxtjs.org/authentication#confirm-page-confirm) page to redirect the user to the page they previously tried to visit.
109
+
- `cookieRedirect`: Sets a cookie containing the path an unauthenticated user tried to access. The cookie can then be used on the [`/confirm`](https://supabase.nuxtjs.org/authentication#confirm-page-confirm) page to redirect the user to the page they previously tried to visit.
108
110
109
111
### `cookieName`
110
112
@@ -121,11 +123,13 @@ Cookie name used for storing access and refresh tokens, added in front of `-acce
121
123
secure: true
122
124
}
123
125
```
126
+
124
127
Options for cookies used to share tokens between server and client, refer to [cookieOptions](https://nuxt.com/docs/api/composables/use-cookie#options) for available settings. Please note that the lifetime set here does not determine the Supabase session lifetime.
Copy file name to clipboardexpand all lines: docs/content/3.authentication.md
+33-11
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Authentication
3
3
icon: heroicons:lock-closed
4
-
description: 'Authenticate your user thanks to the PKCE Oauth protocol that enables secure exchange of refresh and access tokens between an application and the authorization server'
4
+
description: Authenticate your user thanks to the PKCE Oauth protocol that enables secure exchange of refresh and access tokens between an application and the authorization server
5
5
---
6
6
7
7
With the default options, the module requires a log-in page and a confirm page to handle the [PKCE authorization code flow](https://supabase.com/docs/guides/resources/glossary#pkce). If you want to understand how it works under the hood, you can read this [section](https://supabase.com/docs/guides/auth/server-side-rendering#understanding-the-authentication-flow).
@@ -14,8 +14,7 @@ For advanced users who want to implement the auth behaviour themselves, you can
14
14
15
15
## Log-in page - `/login`
16
16
17
-
Each time a user is trying to access a page that needs authentication, he will automatically be redirected to the configured log in page. If you want to allow access to "public" page, you just need to add them in the [exclude](/get-started#redirectoptions) redirect option.
18
-
17
+
Each time a user is trying to access a page that needs authentication, he will automatically be redirected to the configured log in page. If you want to allow access to "public" page, you just need to add them in the [exclude](/get-started#redirectoptions) redirect option.
You can easily handle redirection to the initial requested route after login.
73
83
84
+
::callout{icon="i-heroicons-light-bulb"}
85
+
You must enable the `cookieRedirect` option of the [redirectOptions](/get-started#redirectoptions) to allow cookie storage and take benefit of this feature.
This section assumes you're familiar with [Nitro](https://v3.nuxtjs.org/guide/concepts/server-engine), the server engine powered by Nuxt.
9
8
::
10
9
11
10
This function is working similary as the [useSupabaseClient](/usage/composables/usesupabaseclient) composable but is designed to be used in [server routes](https://nuxt.com/docs/guide/directory-structure/server#server-routes).
This section assumes you're familiar with [Nitro](https://v3.nuxtjs.org/guide/concepts/server-engine), the server engine powered by Nuxt.
9
10
::
10
11
11
-
This function is designed to work only in [server routes](https://nuxt.com/docs/guide/directory-structure/server#server-routes), there is no vue composable equivalent.
12
+
This function is designed to work only in [server routes](https://nuxt.com/docs/guide/directory-structure/server#server-routes), there is no vue composable equivalent.
12
13
13
14
It works similary as the [serverSupabaseClient](/usage/services/serversupabaseclient) but it provides a client with super admin rights that can bypass your [Row Level Security](https://supabase.com/docs/guides/auth/row-level-security).
This section assumes you're familiar with [Nitro](https://v3.nuxtjs.org/guide/concepts/server-engine), the server engine powered by Nuxt.
8
8
::
9
9
10
10
This function is similar to the [useSupabaseUser](/usage/composables/usesupabaseuser) composable but is used in [server routes](https://nuxt.com/docs/guide/directory-structure/server#server-routes).
0 commit comments