Ability to override creation and validation of CSRF token #9176
jeffreyschultz
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
callbacks
already provided, that will allow developers to provide custom functions for handling creation and validation of tokens.Non-Goals
next-auth
.Background
I am currently trying to allow multiple containers within a deployment to use the same
jwt
andcsrf
tokens. The containers are a mix of multiple technologies where the others allow customization of these functions already, and I wish to do the same with thenext-auth
-powerednextjs
frontends.Proposal
Make changes to the configuration objects to allow providing custom callbacks for handling creation and validation of
csrf
tokens. The existing handler code withinnext-auth
will check to see if a callback has been provided, and if so, it will delegate the responsibility to the custom callbacks. If not, then the existing behavior will be used.Alternative
Replace the current
csrf
token implementation with one that can be validated against thesecret
. This will allow sharing of thesecret
across containers, and independent validation thecsrf
token without the involvement of the other containers. The token payload could be anythingnext-auth
wants to use, but the important part for me is that it can be independently validated.Beta Was this translation helpful? Give feedback.
All reactions