Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(destory-session): testing destroy session for all devices using supabase #833

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rockingrohit9639
Copy link
Contributor

@rockingrohit9639 rockingrohit9639 commented Mar 7, 2024

No description provided.

@DonKoko
Copy link
Contributor

DonKoko commented Apr 2, 2024

hey @rphlmr . IDK if you remember but we have this issue: #825
We tried a few different things and this is an approach that Rohit tried. We basically have our own sessions table and manage them in the DB. I am wondering what you think about it and if you have any concerns.
I am not 100% convinced as it seems like we are doing double things and whether it wont be better to just use the sessions table provided by supabase

id String @id @default(cuid())

expires DateTime?
userId String?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about User link here to prevent phantom userId?


expires DateTime?
userId String?
data Json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: normalise instead of hiding in a JSONB col?

Given the schema below:

 email: z.string(),
 userId: z.string(),
 expiresAt: z.number(),
 expiresIn: z.number(),
 accessToken: z.string(),
 refreshToken: z.string(),

we could have a col for:
accessToken, refreshToken


Later in the createDatabaseSessionStorage implementation, we could use the expiresAt from the supabase auth token to populate the expires col of this table?
Then, you control this settings from supabase auth dashboard.

{ status: 500 }
);
}
const updatedData = await db.session.updateMany({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we delete all existing sessions for this userId and then create a new one + save it in the context before redirect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants