supabase icon indicating copy to clipboard operation
supabase copied to clipboard

Do not allow logged in users to access login page

Open chachew opened this issue 1 year ago • 2 comments

Is there an easy way to NOT allow logged in users to access the login/register pages? Once the user is logged in there should be no reason to access those pages, instead they should be redirected to the index page.('/')

Ive tried adding route redirects in the nuxt.config as well as adding a middleware to the login/register pages butt he page is accessed first for a few seconds before it gets redirected to the index page ('/').

loggedIn.ts middleware export default defineNuxtRouteMiddleware(async (to, from) => { const user = useSupabaseUser(); if (user.value) return navigateTo('/'); });

This is not working as expected because it seems there is a few second delay on page load when user accesses the url directly and when the redirect(navigateTo) is fired.

chachew avatar Mar 28 '24 17:03 chachew

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar May 06 '25 13:05 github-actions[bot]

Maybe this should be converted into a discussion?

ojvribeiro avatar May 06 '25 14:05 ojvribeiro