Null
Null
BABetter Auth
Created by Null on 5/21/2025 in #help
[Admin Plugin] Session not updated when user is updated
@bekacru do you think that could be included in better-auth? If so, please tell me so I can work on making a PR changing this.
11 replies
BABetter Auth
Created by Null on 5/21/2025 in #help
[Admin Plugin] Session not updated when user is updated
Also, I think would be dangerous to keep sessions with an old role saved/active.
11 replies
BABetter Auth
Created by Null on 5/21/2025 in #help
[Admin Plugin] Session not updated when user is updated
From userHasPermission code:
const user = session?.user ||
((await ctx.context.internalAdapter.findUserById(
ctx.body.userId as string,
)) as { role?: string; id: string }) ||
(ctx.body.role ? { id: "", role: ctx.body.role } : null);
const user = session?.user ||
((await ctx.context.internalAdapter.findUserById(
ctx.body.userId as string,
)) as { role?: string; id: string }) ||
(ctx.body.role ? { id: "", role: ctx.body.role } : null);
11 replies
BABetter Auth
Created by Null on 5/21/2025 in #help
[Admin Plugin] Session not updated when user is updated
Permission checks are done using user at the session, so if session isn't updated, user would need to logout to have role updated.
11 replies
BABetter Auth
Created by Null on 5/21/2025 in #help
[Admin Plugin] Session not updated when user is updated
Okay, I see, it happens because updateUser has this line:
/**
* Update the session cookie with the new user data
*/
await setSessionCookie(ctx, {
session: session.session,
user,
});
/**
* Update the session cookie with the new user data
*/
await setSessionCookie(ctx, {
session: session.session,
user,
});
I think at least activeSessions should be updated in this case, I understand why it might not be a good default, but adding an optional setting for this would be really helpful.
11 replies
BABetter Auth
Created by Null on 5/21/2025 in #help
[Admin Plugin] Session not updated when user is updated
Could you help me with this @Ping ?
11 replies
BABetter Auth
Created by Null on 5/21/2025 in #help
[Admin Plugin] Session not updated when user is updated
11 replies
BABetter Auth
Created by aali on 5/20/2025 in #help
Better Auth (auth.api.getSession) causes problem in edge runtime
6 replies