Error with sessions
Hello i have the code to signUp and login the user. The user is registered and the email is confirmated. I tried to login with a user and send him to the dashboard page but nohting is working.He is sent to the login page because no session was found. That is the response of One the picture you can see the response of signInWithPassword.I had no errors with Postgres. Here is my signInWithPassword method:
const [user, setUser] = useState(null);
useEffect(() => {
const session = supabase.auth.getSession();
setUser(session?.user ?? null);
const { data: authListener } = supabase.auth.onAuthStateChange(
async (event, session) => {
const currentUser = session?.user;
setUser(currentUser ?? null);
}
);
return () => {
authListener?.subscription.unsubscribe();
};
}, [user]);
`
export async function signInWithPassword(email, password) {
const response = await supabase.auth.signInWithPassword({
email: email,
password: password,
});
return response;
}
function App() {const [user, setUser] = useState(null);
useEffect(() => {
const session = supabase.auth.getSession();
setUser(session?.user ?? null);
const { data: authListener } = supabase.auth.onAuthStateChange(
async (event, session) => {
const currentUser = session?.user;
setUser(currentUser ?? null);
}
);
return () => {
authListener?.subscription.unsubscribe();
};
}, [user]);
`