-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Summary
Calling client.signOut({ returnTo }) succeeds when a user is logged in, but if no session exists the method does nothing and the user stays on the /logout page (or wherever url they were). This creates a confusing UX because visiting /logout should always redirect the user away, regardless of session state.
Expected Behavior
client.signOut() should redirect to the provided returnTo URL even when there is no active session.
Alternatively, the method should throw or return a clear signal that no session exists so applications can handle the redirect manually.
Actual Behavior
If there is no WorkOS session cookie:
signOut()performs no redirect- No error is thrown
- The user remains on the
/logoutroute
This occurs if a user clears cookies, opens an old tab, has an expired session, or visits /logout directly.
Steps to Reproduce
- Ensure no WorkOS session cookie exists (incognito window).
- Call:
client.signOut({ returnTo: 'https://example.com/logged-out' });
- Observe that no redirect happens.
$$ Possible Solutions
- Always redirect to returnTo, even without a session.
- Or throw a clear error
Metadata
Metadata
Assignees
Labels
No labels