New AuthSessions and AuthRefreshTokens after each login
Hello there!
I have this issue, everytime I login with my google provider I have a new authSessions and authRefreshTokens.
here is my auth code:
17 Replies
This happens both in development and production. Apart from that, everything is okay.
I think that's working as expected. Every time the user signs in, a new session is created.
I appreciate your response. What I mean is that if I log in 4 times with the same user I get 4 different sessions, it is strange because before that I was getting one session per user but it was modified every time I logged in.
If that is the case what becomes of those old sessions, will they be deleted automatically?
beforeWas this a different version of the library? What changed?
I think it was a different version sir but what becomes of those old sessions?
@Ferdinand What does logging in 4 times mean, are you clicking the login button in a page that's already logged in? Using another tab where the user wasn't logged in and the UI hadn't updated?
Thanks for your response. When I log in the first time, it creates one authSession and one authRefreshToken. When I sign out and then log in again with the same user, another set of sessions are created with new id's.
That sounds expected to me, it's a new session when you log out and log in.
If you have state you want to last longer than this you could store it in a table with user ids in it
I tried logging in and signing out 5 times and in my dashboard, I have 5 different sessions.
Ah so they're not getting deleted, is that what's unexpected?
yes sir
Any updates for my issue Mr Tom?
I'll take a look soon, I need to try to repro. What are you using on the frontend in case that matters for the repro?
Thanks for your concern. I'm using next js
Hello any updates Mr Tom ?
This is the same thing I was wondering, should the auth session and authRefreshToken be deleted from the db when a user signs out? Because right now it doesn’t delete it from the db when a user signs out
Yes it should because every time you sign in a new one will be created
Hello @ballingt any updates?
I can repro this, it's Next.js specific
@Ferdinand @Mrod this is fixed in
@convex-dev/auth@0.0.56
Thanks much @Michal Srb will try it right now
@Michal Srb just tested and everything is working perfectly. 👍