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

Missing userInfo type in options for generateCsrf #150

Open
2 tasks done
likerRr opened this issue Jan 9, 2024 · 2 comments
Open
2 tasks done

Missing userInfo type in options for generateCsrf #150

likerRr opened this issue Jan 9, 2024 · 2 comments

Comments

@likerRr
Copy link

likerRr commented Jan 9, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

Not actually a bug, just a missing userInfo typing for generateCsrf decorator function. Now function parameters accept only fastifyCsrfProtection.CookieSerializeOptions, but userInfo should also be possible to pass

@Uzlopak
Copy link
Contributor

Uzlopak commented Jan 9, 2024

I did not investigate now if this is a valid claim. But if you are willing to provide a PR with tests and typings, I can promise you that we can evaluate it and merge it in a timely manner.

@pmithunish
Copy link

I confirm that this is true. The typing is indeed missing or broken. When I pass the userInfo to the reply.generateCsrf({ userInfo } as unknown as CookieSerializeOptions), the plugin works as expected. In the documentation, it is mentioned to pass the userInfo argument in a specific case. While fixing the typing, might as well add an example to the documentation to be more clear.

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

3 participants