Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The GET method is not supported for route api/login. Supported methods: POST

i made a post route in laravel but when access it i find that get request was sent this is error Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: The GET method is not supported for route api/login. Supported methods: POST

  • these are post routes
  • this is request that i sent from postman
like image 661
Mohamed ElMohands Avatar asked Sep 06 '25 08:09

Mohamed ElMohands


2 Answers

This happens primarily because of validation issues of API as the Laravel validator sends back to the same URL, Like in this case, it is redirecting back to the login route by the GET method so it's saying you method not allowed.

For this issue, you need to change Postman settings where you need to uncheck Automatically follow redirects to off.

enter image description here

like image 181
Ahmed Memon Avatar answered Sep 09 '25 19:09

Ahmed Memon


If you're making the request from a tool like Postman or curl, ensure that you include the Accept: application/json header in your request. This informs Laravel to respond with JSON.

like image 29
Abenezer Kebede Avatar answered Sep 09 '25 18:09

Abenezer Kebede



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!