Refresh the page after authClient.signOut()

I have something like
const handleSingOut = async () => {
  await authClient.signOut();
  router.push("/login");
};

  • I have an index, a login and a protected page
  • On the protected page, I display the session and have a sign out button
  • When I click on sign out, I do get signed out[I see that the better-auth session is removed from the cookies] and I am then redirected to the home page
  • But even after that, if I navigate to the, say, protected page, I can still see the session that I had displayed, the sign out button, etc.
  • However, when I refresh the page, then things work normally. I am prompted to login again.
I'm new to Nuxt.
I'm thinking it has something to do with caching or some of the checks not being performed on the client.

Does anyone have an idea what I might be missing?

Setup: Nuxt | Better-Auth | Drizzle ORM | PostgreSQL | Google Provider

Thank you.
Was this page helpful?