Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout route is not destroying the user session #183

Open
McNouvion opened this issue Feb 7, 2024 · 0 comments
Open

Logout route is not destroying the user session #183

McNouvion opened this issue Feb 7, 2024 · 0 comments

Comments

@McNouvion
Copy link

Have you experienced this bug with the latest version of the template?

Yes

Steps to Reproduce

Just setup a new project, create an account and login, then hit '/logout'
When I get back to the home page I'm still signed in ...

I did not spend a ton of time trying to figure out the root cause but nothing I did in the session.server.ts file seemed to have any effects. I suspect something else is setting/committing the session back in?

For now I just updated the logout.tsx loader which I think is called out as something you should not do in the docs
(?? Sorry I have only started using remix a few weeks ago).

export const loader = async ({ request }: LoaderFunctionArgs) => {
  const session = await getSession(request);

  return redirect("/", {
    headers: {
      "Set-Cookie": await sessionStorage.destroySession(session),
    },
  });
};

Expected Behavior

When I hit the /logout route, the session is destroyed and I'm redirected to the homepage where I see a login and a signup button.

Actual Behavior

I'm redirected to the homepage where I see the "View notes" button.
I also cannot navigate to the login page.

@McNouvion McNouvion changed the title Logout route is no destroying the user session Logout route is not destroying the user session Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant