signInWithPassword does not sign in in v2, but signin in v1 works fine

I have a problem with the signin method in supabase-js.

If i call the signInWithPassword method with an email and password, the response i get has no errors and has a session and a user. However if i try calling getSession afterwards the session i get from it is null. I also have an rls policy set up on a table and if i try to select from the table i get 0 result as if i was not authenticated.

If i use v1 of supabase-js and use the signIn method, then i can select from the table just fine and get the results that i should. As far as i can see from the docs it does not looke like i am missing something.

const res = await supabase.auth.signInWithPassword({ email: 'test@email.com', password: '12345678', }); const { data, error } = await supabase .from('test') .select(); expect(data?.length).toBe(1);

Am i doing something wrong?
Was this page helpful?