Skip to content

signOut() does not work if not using middlewareΒ #261

@dustinboss

Description

@dustinboss

The signOut method does not work as expected if the application is not using the authkit-nextjs middleware.

I am not using the auth middleware. Instead, I've created my own middleware using the authkit (as supported in the authkit-nextjs docs). When I call the signOut method, it successfully removes the wos-session cookie, but it doesn't remotely logout of the WorkOS domain. As a result, the next time the user goes to the sign-in endpoint, it automatically logs them in because they're still signed in to the WorkOS domain.

This seems to be happening because the signOut method uses withAuth to get the Session ID, but I believe that withAuth only works on routes that are using the authkit-nextjs middleware. As a result, it gets no Session ID and so doesn't ever attempt to logout remotely. It also doesn't throw any error or give any indication that it didn't find a Session ID.

Here are some possible solutions:

  1. signOut method can read the Session ID in some other way, so it doesn't rely on the middleware.

  2. authkit-nextjs can make expose a method that allows the user to manually delete the wos-session cookie. This would make it easier to build customer sign out flows.

Thank you!

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