NuxtN
Nuxt3mo ago
Asher

Failed to signin with google using @nuxtjs/supabase

Hey, i'm using Supabase for the authentication with Google, I have this function
const loading = ref(false)
const error = ref(null)
const supabase = useSupabaseClient()

async function signInWithGoogle() {
    loading.value = true
    error.value = null

    try {
        const { data, error } = await supabase.auth.signInWithOAuth({
            provider: "google",
            options: {
                redirectTo: `http://localhost:3000/confirm`,
            },
        })

        if (error) {
            throw error
        }
    } catch (err) {
        console.error("Login error:", err)
        loading.value = false
    }
}

The authentication works, but not the redirection, it redirect me to /login with this option ?code=XXX-XXX.....

Any idea why ?
Was this page helpful?