Can't get credentials verification POST through to API at /api/auth/signin/credentials? #5350
Answered
by
CrabBucket
CrabBucket
asked this question in
Help
Replies: 2 comments 1 reply
-
Also if anyone could direct me to the source code for how Next-Auth generates the default signin page I could probably just copy how you guys did it in there? I searched for this a bit already and looked around in the repo but I'm pretty new to TypeScript |
Beta Was this translation helpful? Give feedback.
1 reply
-
Refactoring to use signin fixed it for me but I still don't understand why I can't get the csrfToken from the api and submit my own POST. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
CrabBucket
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.
-
Error Code is "Error: This action with HTTP POST is not supported by NextAuth.js"
Hello I am trying to implement my own login page using NextJS and Next-Auth for auth I haven't even gotten to checking the credentials in the database yet but I can't figure out how to format my POST request properly for the server to try to acknowledge the request,
Here is the code for the JS Fetch that gets called from a forms onSubmit:
And here are the two payload strings from the requests accepted payload: "csrfToken=872a8e45099f8fa07b0c528137162b3864070972150e0d863bcca6c6f169d708&username=&password=&rememberCheck=on"
Not accepted payload: "csrfToken=907497b8f6ab7c46b1dbdc7d6fe3172d7916777c5283b3e61e672ee587e5ac64&username=test&password=test&rememberCheck=test"
(rememberCheck is a text field in the default signin form)
Are csrfTokens going be unique across redirects? If I go to api/auth/signin and submit the post request that way I get a valid response back and it redirects me to the login page (callBack I believe) with a good response and at that login page if use my POST I get a 400 error in the console and the preview says "Error: This action with HTTP POST is not supported by NextAuth.js"
Any help would be great, I originally thought it was malformed stringfied JSON (I wasn't url encoding it) but now my payload look exactly the same so I think it must be some configuration issue on my end or something that I'm just not aware of.
Here is my API endpoint but I don't think any code inside this block of is being ran so I think it's some config check that's failing or potentially something with csrf.
Here is my .env.local
Beta Was this translation helpful? Give feedback.
All reactions