Supabase Nuxt 3 Redirecting to Login on Login

414 views Asked by At

I've got Supabase '@nuxtjs/supabase' running, it was working fine until I moved some layout's around and now I just cannot get it to redirect to a /confirm page on successful login. Any help would be great.

layout/default.vue

<template>
    <div class="dark bg-gray-800 min-h-screen w-screen h-screen overflow-hidden">
        <NuxtPage />
    </div>
</template>

login.vue

<template>
  <Auth />
</template>
  
<script setup>
    definePageMeta({
      layout: "page",
    });

    const user = useSupabaseUser()

    console.log(user.value)
  
    const linkDestination = ref(user.value ? '/generate' : '/login');
</script>
  

Then my nuxt.config

  supabase: {
    redirectOptions: {
      login: '/login',
      callback: '/confirm',
      exclude: []
    }
  },

On login with either magic link or OAuth provider, just redirects me back to the /login page and user.value is null

Am I doing something plain wrong here?

1

There are 1 answers

1
Ondairos On

You could use inside your defineNuxtConfig outside of the app:{} if you have it:

supabase: { redirect: false, },