The GET method is not supported for route logout. Supported methods: POST in laravel when manually type logout in url

My laravel version is 9.19. When I click on logout menu its working fine.
But when I manually type ‘logout’ in url it gives the error – The GET method is not supported for route logout. Supported methods: POST.

enter image description here

It shows as a POST route in route:list:

POST logout .............. logout › Auth\LoginController@logout

in web.php:

Auth::routes( [ 'register' => false ] );

How can i solve this in case of manually type ‘logout’ in url?

  • it isn’t a GET route, it is a POST route … there is no reason to type in a URL to logout and it shouldn’t be a simple link, causing a GET request … there is good reason for this being a POST route

    – 

  • Either use logout as POST request OR do Route::get(...logout class here@method) in your auth.php or wherever your logout route is located.

    – 




  • Though it is better to use POST request for logout as per what @lagbox said!

    – 

  • having said all of that, if you really wanted to you could create a GET route that points to that same action on that controller as stated by Mr.Kenneth, just don’t put it into production with that route existing

    – 




  • 1

    Why would you, or anyone, manually type the URL?

    – 

Leave a Comment