vendredi 13 mars 2020

Laravel Route Issue - Error 405 Method Not Allowed

Laravel 5.8 - Is the VerificationController@verify method protected from POST?

I am having a strange error with a Laravel route and having a difficult time determining where my issue is. All other POST routes work (ie. login, logout, and register, to name a few).

in api.php

Route::prefix('auth')->group(function () {
  Route::post('/verify/{email-token}',    'Auth\VerificationController@verify');
}

route:list shows POST | api/auth/verify/{email-token} | Auth\VerificationController@verify | api

Chrome Console shows POST route XHR POST http://laravel.test/api/auth/verify/kjsdlagkj

The Error The POST method is not supported for this route. Supported methods: GET, HEAD.

I made a GET route with a different path in web.php and that route was able to access the method with no issue. So I know my routes can see this controller.

I also tried a POST route in web.php Route::post('/user/verify/{email-token}', 'Auth\VerificationController@verify');

XHR POST XHR POST http://laravel.test/user/verify/kjsdlagkj and again Error 405



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire