Skip to content

Conversation

@nicknisi
Copy link
Member

@nicknisi nicknisi commented Jan 2, 2026

Summary

  • signOut() now throws NoSessionError when called without an active session and no returnTo URL
  • When returnTo is provided but no session exists, redirects directly to that URL
  • Added NoSessionError to public exports for consumer error handling

Why

Previously, signOut() silently did nothing when no session existed, leaving users stuck on the logout page with no feedback. This created a confusing UX when users visited /logout directly, cleared cookies, or had expired sessions.

Notes

Previously, signOut() silently did nothing when called without an
active session, leaving users stuck on the logout page.

Now signOut() handles the no-session case explicitly:
- No session + no returnTo: throws NoSessionError
- No session + returnTo + navigate:true: redirects to returnTo
- No session + returnTo + navigate:false: resolves silently

When navigate:false, errors are returned as rejected Promises to
match the Promise<void> return type signature.

Closes #98
@nicknisi nicknisi merged commit e7b4875 into main Jan 8, 2026
4 checks passed
@nicknisi nicknisi deleted the nicknisi/98-sign-out-issues branch January 8, 2026 15:14
@nicknisi nicknisi mentioned this pull request Jan 8, 2026
nmajor25 added a commit to RoundingWell/care-ops-frontend that referenced this pull request Jan 8, 2026
To include workos/authkit-js#104

Which fixes a bug in our app where logout url redirect wasnt working properly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

🐛 client.signOut() does nothing if the user is not logged in, leaving them stuck

3 participants