Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

signIn / signOut not working properly #345

@matheustav

Description

@matheustav

Bug report

Describe the bug

Hi! I think signOut method is not properly destroying the session until the page is refreshed.

To Reproduce

  1. Sign in
  2. Get data from database related to user
  3. Sign out
  4. Sign in again with another user
  5. Try to get user-related data from db again

I'm using this code to test:

// Login
setTimeout(
    async () => console.log( await this.$supa.auth.signIn( { email: 'user111@test.com', password: 'foo123' } ) ),
    1000
);

// Profile
setTimeout(
    async () => console.log( await this.$supa.from( 'profiles' ).select().single() ),
    2000
);

// Logout
setTimeout(
    async () => console.log( await this.$supa.auth.signOut() ),
    3000
);

// Login again
setTimeout(
    async () => console.log( await this.$supa.auth.signIn( { email: 'user222@test.com', password: 'bar123' } ) ),
    4000
);

// Profile
setTimeout(
    async () => console.log( await this.$supa.from( 'profiles' ).select().single() ),
    5000
);

The problem is that both select profile requests always returns the same profile.

  1. If I logged In with user1 first, then both profiles will be from user1.
  2. If I change the code, switching the signIn order (user2 before), then both profiles will be from user2 now.

Expected behavior

To each select get only the profile of the authenticated user.

Screenshots

My RLS:
2022-03-24_16-12-29

Testing with user1 before:
2022-03-24_16-03-39

Now switching the signIn credentials:
2022-03-24_16-06-44

System information

  • OS: Arch Linux 5.15.29-1-lts x64
  • Firefox 98.0.1
  • Version of supabase-js: v1.31.2
  • Version of Node.js: v16.14.2

Metadata

Metadata

Assignees

Labels

authbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions