nuxt-modules / supabase

Supabase module for Nuxt.
https://supabase.nuxtjs.org
MIT License
733 stars 129 forks source link

OTP auth not working on mobile #303

Open fdarkaou opened 1 year ago

fdarkaou commented 1 year ago

Hi there,

When logging in using OTP (const { error } = await client.auth.signInWithOtp({ email: email.value });) after clicking on the magic link received in my mailbox, the session is not being set and log in does not work. The only way to log in is to use Google Auth. This is something that used to work in previous releases but sadly it stopped after upgrading.

On desktop it seems to be working fine.

I think this issue might be related to this one mentioned here: https://github.com/nuxt-modules/supabase/issues/264

Version

@nuxtjs/supabase: ^1.1.3 nuxt: ^3.6.2

Has anyone else had this as well and any workarounds I can try out?

I have already added this to my middleware to process on client side only:

// /middleware/auth.js export default defineNuxtRouteMiddleware((to, _from) => { const user = useSupabaseUser() if (!user.value && process.client) { return navigateTo('/login') } })

And I am using the implicit flow in my confirm component. Manually setting the cookies won't work of course because the redirect url uses the format ?code=...

Please, any help is appreciated!