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

Delete cookie as user logout #170

Open
chauhankiran opened this issue Mar 30, 2024 · 0 comments
Open

Delete cookie as user logout #170

chauhankiran opened this issue Mar 30, 2024 · 0 comments
Labels
support Questions, discussions, and general support

Comments

@chauhankiran
Copy link

chauhankiran commented Mar 30, 2024

Runtime

Node

Runtime version

v20.12.0

Module version

11.0.2

Used with

@hapi/boom, @hapi/cookie, @hapi/hapi, @hapi/inert, @hapi/vision

Any other relevant information

I'm using @hapi/cookie for the authentication aid @hapi/yar for storing lots of information (e.g. three dozens objects with each having 40-50 properties). (Is it fine?)

How can we help?

After successful login, I'm seeing two cookies in browser's Inspect Element > Application tab. One is for auth and second is for session. When I logout, I've written,

const logout = async (request, h) => {
  request.cookieAuth.clear();

  return h.redirect("/auth/login");
};

This clear the cookie related to auth. But, not one that is used for session. How can I clear that as well? I've added

request.yar.clear("fields");

as

const logout = async (request, h) => {
  request.cookieAuth.clear();
  request.yar.clear("fields");

  return h.redirect("/auth/login");
};

Here, fields is the name of session that I've used to save the fields for module. But, still not clearing.

@chauhankiran chauhankiran added the support Questions, discussions, and general support label Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Questions, discussions, and general support
Projects
None yet
Development

No branches or pull requests

1 participant