Skip to content

Commit

Permalink
docs(app): added documentation for Commit 96b799
Browse files Browse the repository at this point in the history
updating the docs to match previous pull request
  • Loading branch information
Matthewenderle committed Jan 23, 2024
1 parent 96b799b commit 25e97da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/content/2.get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ Default:
login: '/login',
callback: '/confirm',
exclude: [],
cookieRedirect: false,
}
```
- `login`: User will be redirected to this path if not authenticated or after logout.
- `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 -> URL Configuration -> Redirect URLs`.
- `exclude`: Routes to exclude from the redirect. `['/foo', '/bar/*']` will exclude the `foo` page and all pages in your `bar` folder.
- `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.
### `cookieName`
Expand Down
10 changes: 9 additions & 1 deletion docs/content/3.authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,17 @@ The redirect URL must be configured in your Supabase dashboard under `Authentica
```vue [pages/confirm.vue]
<script setup lang="ts">
const user = useSupabaseUser()
// Pull in the config to get cookie details
const config = useRuntimeConfig().public.supabase;
const { cookieName } = config;
const redirectPath = useCookie(`${cookieName}-redirect-path`).value;
watch(user, () => {
if (user.value) {
return navigateTo('/')
useCookie(`${cookieName}-redirect-path`).value = null // Clear the cookie
return navigateTo(redirectPath || '/'); // Redirect or go to protected page
}
}, { immediate: true })
Expand Down

0 comments on commit 25e97da

Please sign in to comment.