skip to Main Content

i made a post route in laravel but when access it i find that get request was sent
this is error SymfonyComponentHttpKernelExceptionMethodNotAllowedHttpException: 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

3

Answers


  1. If you wan’t to acces to the route with a normal view (GET method) you need to change your code with Route::get in your writed code way you only accept POST method Route::post set olso the accept in application/json otherwise in postman you will see an html file

    Login or Signup to reply.
  2. Put your login/register route outside of middleware group.

    Login or Signup to reply.
  3. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search