[GH-ISSUE #858] useSession hook does not update after passkey authentication #8468

Closed
opened 2026-04-13 03:32:47 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @eyenalxai on GitHub (Dec 11, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/858

workaround: You can call authClient.$store.notify("$sessionSignal") on the client where needed

Describe the bug
The useSession hook does not update when a user successfully authenticates using a passkey. The session state remains unchanged

To Reproduce
Steps to reproduce the behavior:

  1. Sign in using passkey authentication
  2. Observe that the useSession hook does not update to reflect the authenticated status

Expected behavior
The useSession hook should update to reflect the authenticated session state after a user successfully authenticates with a passkey.

Additional context
When I authenticate with a passkey, "/passkey/verify-authentication" path is not passing through any atom listeners at all, unlike, for example, "/two-factor/verify-totp", so I can't even bind it to the "$sessionSignal" (if I even understood correctly how internals work -_-) and I can't figure out why is what. When comparing both client plugins nothing seems that different in how they're implemented.

Originally created by @eyenalxai on GitHub (Dec 11, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/858 workaround: You can call `authClient.$store.notify("$sessionSignal")` on the client where needed **Describe the bug** The `useSession` hook does not update when a user successfully authenticates using a passkey. The session state remains unchanged **To Reproduce** Steps to reproduce the behavior: 1. Sign in using passkey authentication 2. Observe that the `useSession` hook does not update to reflect the authenticated status **Expected behavior** The `useSession` hook should update to reflect the authenticated session state after a user successfully authenticates with a passkey. **Additional context** When I authenticate with a passkey, `"/passkey/verify-authentication"` path is not passing through any atom listeners at all, unlike, for example, `"/two-factor/verify-totp"`, so I can't even bind it to the `"$sessionSignal"` (if I even understood correctly how internals work -_-) and I can't figure out why is what. When comparing both client plugins nothing seems that different in how they're implemented.
GiteaMirror added the lockedbug labels 2026-04-13 03:32:47 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 11, 2025):

Hi, @eyenalxai. I'm Dosu, and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • The useSession hook does not update after passkey authentication.
  • The path "/passkey/verify-authentication" fails to trigger atom listeners.
  • A temporary solution involves manually invoking authClient.$store.notify("$sessionSignal").
  • No further comments or activity have been made on this issue.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting here.
  • If there is no response, the issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

<!-- gh-comment-id:2963384244 --> @dosubot[bot] commented on GitHub (Jun 11, 2025): Hi, @eyenalxai. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - The `useSession` hook does not update after passkey authentication. - The path `"/passkey/verify-authentication"` fails to trigger atom listeners. - A temporary solution involves manually invoking `authClient.$store.notify("$sessionSignal")`. - No further comments or activity have been made on this issue. **Next Steps:** - Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting here. - If there is no response, the issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Author
Owner

@Bekacru commented on GitHub (Jun 16, 2025):

not stale

<!-- gh-comment-id:2974854063 --> @Bekacru commented on GitHub (Jun 16, 2025): not stale
Author
Owner

@Mokhtar25 commented on GitHub (Aug 12, 2025):

facing the same issue

<!-- gh-comment-id:3181186819 --> @Mokhtar25 commented on GitHub (Aug 12, 2025): facing the same issue
Author
Owner

@SkepticMystic commented on GitHub (Aug 25, 2025):

Also

<!-- gh-comment-id:3220555101 --> @SkepticMystic commented on GitHub (Aug 25, 2025): Also
Author
Owner

@snibbo71 commented on GitHub (Sep 3, 2025):

As am I. I have, following the dosubot thingy above, implemented the workaround mentioned in my code - though I really not sure of the ramifications of it... I have the following code;

await authClient.signIn.passkey({
fetchOptions: {
onSuccess: () => {
authClient.$store.notify("$sessionSignal");
toast.success("You are now logged in, welcome");
},
onError: () => {
toast.error("An error occurred with your passkey");
},
},
});

There's some more logic in my code but that's the bit I've changed to get the authClient.useSession() to notice when a passkey user logs in.

<!-- gh-comment-id:3249972400 --> @snibbo71 commented on GitHub (Sep 3, 2025): As am I. I have, following the dosubot thingy above, implemented the workaround mentioned in my code - though I really not sure of the ramifications of it... I have the following code; await authClient.signIn.passkey({ fetchOptions: { onSuccess: () => { authClient.$store.notify("$sessionSignal"); toast.success("You are now logged in, welcome"); }, onError: () => { toast.error("An error occurred with your passkey"); }, }, }); There's some more logic in my code but that's the bit I've changed to get the authClient.useSession() to notice when a passkey user logs in.
Author
Owner

@issam-seghir commented on GitHub (Sep 17, 2025):

#4731

<!-- gh-comment-id:3304744933 --> @issam-seghir commented on GitHub (Sep 17, 2025): #4731
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8468