1

I am developing a custom authentication plugin for Craft 3. But I can't route to my Controller via POST request with my login form. Request via GET work

2
  • Have you a problem with Csrf? Or can you specify more precisely what's your problem.
    – lenka
    Commented Oct 17, 2018 at 13:03
  • Can you add some additional details? As your question currently stands, it's far to broad to know what the problem may be.
    – Lindsey D
    Commented Oct 17, 2018 at 18:53

1 Answer 1

1

Although your question is lacking in detail, here is a shot at helping you track down the issue. The fact that GET requests are working but POST requests are not, your form is likely missing a CSRF token. You can add it to your form using the following twig code:

<form method="post" action="">

   {{ csrfInput() }}

If your POST request is coming through as an AJAX request then you can create and submit a CSRF token as described in this answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.