Authentication not working

Hello,
Context
I was working on my project when I stumbled across a problem.
Supabase email authentication is not working, more specifically, the token in not being saved as it used to.

The problem
So previously, when a user signed in or signed up the session token used to be saved in browser's local storage (I didn't code it to, it saved itself automatically after authentication).
But not anymore, and I don't know the reason behind it.

supabase sign up code in Next
export const signUp = async ({
    email,
    password,
}: {
    [key: string]: string;
}) => {
    const {
        data: { user },
        error,
    } = await supabase.auth.signUp({ email, password });
    if (error) {
        return Promise.reject(new Error("Signup error: Invalid credentials"));
    }
    return Promise.resolve(user);
};


sign up form event in Next
const onCreateUser = (e: React.FormEvent<HTMLFormElement>) => {
        e.preventDefault();
        setLoading(true);
        signUp({ email, password })
            .then((user) => router.replace("/explore"))
            .catch((err) => setError(true))
            .finally(() => setLoading(false));
    };


Q1. What version of Next and Supabase am I using?
Ans - Next 13.0.5 and Supabase v2. The previous working code was on the same version as well.

Q2. Did you update/change your previously working code?
Ans - No, it's the same piece of code that used to work.

Q3. Time gap between the working and non-working version?
Ans - a week and a half. Two week before today.

I will be happy to answer any more queries, and appreciate anyone that helps. Thanks!
Was this page helpful?