Skip to content

Regression after fix for #98: signOut redirects correctly, but signIn() immediately results in a logged-in state #109

@paulfalgout

Description

@paulfalgout

Hi 👋 following up on #98, which was resolved (thank you!). After upgrading to the latest version of @workos/authkit-js, we’re seeing unexpected behavior in our logout/login flow.


Summary

After calling signOut(), the user is redirected back to our app as expected. On page load, the user is not authenticated. However, when our app calls signIn(), the user is immediately logged in, without seeing a login prompt or taking any explicit action.

Reverting to the previous version of authkkit-js restores the expected behavior, with no code changes on our end.


Expected behavior

  1. client.signOut({ returnTo }) redirects back to the app
  2. client.getUser() indicates the user is not authenticated
  3. Calling client.signIn() shows the login UI
  4. User must authenticate before being logged in

Actual behavior (latest version)

  1. signOut() redirects back to the app
  2. client.getUser() indicates the user is not authenticated
  3. App calls client.signIn()
  4. User is immediately logged in, without seeing a login prompt

Relevant code

Auth gate on load:

const isAuthenticated = await client.getUser();

if (!isAuthenticated) {
  client.signIn({ state: path }); // this happens after a logout
} else {
  runApp();
}

xref: https://github.com/RoundingWell/care-ops-frontend/blob/develop/packages/care-ops-auth/providers/workos.js

No changes were made to this logic between versions.

Notes / Observations

This behavior did not occur before the fix for #98
Redirect works, but authentication state appears to persist

Happy to test a patch or provide a minimal repro if helpful.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions