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

  • Have you a problem with Csrf? Or can you specify more precisely what's your problem. – lenka Oct 17 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 Oct 17 at 18:53

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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