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

Cookies are getting signed but not unsigned #706

Open
binamralamsal opened this issue Jul 7, 2024 · 1 comment
Open

Cookies are getting signed but not unsigned #706

binamralamsal opened this issue Jul 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@binamralamsal
Copy link

What version of Elysia.JS is running?

1.0.26

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

const app = new Elysia({
  cookie: {
    httpOnly: true,
    secure: true,
    secrets: env.COOKIE_SIGNATURE,
    sign: ["accessToken", "refreshToken"],
  },
})

When I am using Cookie Signature, it's signing the cookies but it's not unsigning them when accessing it.

What is the expected behavior?

It should unsign the cookies while accessing it.

What do you see instead?

If the cookie is altered, I get the error saying "accessToken" has invalid cookie signature but when accessing it, it's not getting unsigned.

Additional information

I have a separate handler for auth related stuff like this:

export const authControllers = new Elysia()
  .use(setup)
////
@binamralamsal binamralamsal added the bug Something isn't working label Jul 7, 2024
@binamralamsal
Copy link
Author

Well, looks like this doesn't work as I expected when using cookie schema (I was using it on logout route only) or probably I am dumb to not understand this. Removing cookie schema works fine but I am not sure if it should be considered an issue or not.

If this is an intentional behavior, then you can close this issue and please also provide short explanation as I am extremely confused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant