Open liuhuapiaoyuan opened 2 months ago
https://authjs.dev/guides/pages/signin
I am using this page's demo
This problem has been around for a while, and nobody seems to take action about it, i don't know, maybe it has become a feature.
Too bad, can't anyone answer?
This appears to still be broken, can someone take a look please.
In particular, the Missing CSRF error appears if you have a custom signin pages. Steps to reproduce are:
Currently, this can be solved by using the signin on the client side.
import { signIn } from "next-auth/react";
I think I might have this working now. In my case, my middleware was pointing to the original signin url rather than my custom page. I factored this out into constants to make it clearer where my code was using each URL.
I've shared an example repo which shows how I managed to get it to work.
https://github.com/jr200/nats-skeleton-nextjs
@liuhuapiaoyuan I'd be interested to hear if your issue is different from mine, or if you think i'm doing something unusual/incorrect.
I think I might have this working now. In my case, my middleware was pointing to the original sign-in URL rather than my custom page. I factored this out into constants to make it clearer where my code was using each URL.
I've shared an example repository that shows how I managed to get it to work.
https://github.com/jr200/nats-skeleton-nextjs
I would be interested to hear if your issue is different from mine, or if you think I am doing something unusual or incorrect.
??, It should not have this problem if auth
is used as a middleware directly, shouldn't it?
Environment
Reproduction URL
https://github.com/liuhuapiaoyuan/nextjs-auth-misscsrf
Describe the issue
The code is exactly the same as the official demo, but it still prompts MissCSRF
How to reproduce
Expected behavior
Stop missing CSRF at this time!