CSRF token gets inconsistently invalidated if I mutate the provider oAuth URL's #949
Unanswered
ChuckJonas
asked this question in
Help
Replies: 2 comments
-
🤦 ... Not sure how I missed this on my first scan of the code but it's right there... The secret is created by hashing the Doesn't seem like this "secret" option is documented. Throws a type error when I set it, but everything is at least working now. |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can find the documentation for the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Your question
Why is my CSRF token getting invalidated (inconsistently) if I mutate the provider oAuth URL's?
What are you trying to do
I've tried my best to debug what is actually going on, but I'm stumped.
In order to try and support Salesforce, for which a single oAuth app can be used for different tenants, I've attempted to override the base oAuth urls by passing a parameter into the
signin
function like so:I know this is a hack, but it seems like it should work. And it does work! But only ~50% of the time 😞.
The other half, I get redirected to
/api/auth/signin?csrf=true
. I've confirmed it's happening on this line because!csrfTokenVerified
, but I can't seem to figure out why. I don't see anything in the code that would cause this to happen. Based on the inconsistency, it seems like it has to be a race condition of some sort.Reproduction
I can try to provide a reproduction if no one has any ideas why this might be happening...
Feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.
Beta Was this translation helpful? Give feedback.
All reactions