Jo Micheal
Published in : 2022-08-03
Hello everybody,
I have a problem in my API Laravel 9x it returns 419 Page Expired, However everything is fine with the request,
api.php looks like
<?phpuse Illuminate\Http\Request;use Illuminate\Support\Facades\Route;use App\Http\Controllers\authentication\UsersController;Route::controller(UsersController::class)->prefix('/user')->group(function (){ Route::post('/signup', 'create');});
Any Idea why this happen?
Join our community and get the chance to solve your code issues & share your opinion with us
Sign up Now
Mohamed Atef Date : 2022-08-03
Best answers
51
Best answers
51
Welcome Back Jo,
This issue usually happens in the new Laravel setup because you need to exclude the API routes from the middleware of CSRF verification.
you will find a file called VerifyCsrfToken.php in app/Http/middleware/VerifyCsrfToken.php you should edit the file and update the expect array to include “api/*” like this
Good Luck