Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

muazzamazaz's avatar

Getting Session expired error code 419 with callback request to woocommerce

I have callback request to woocommerce with this code below:

Route::get('/woo/authorize', function (Request $request) {
$store_url = 'https://easywaretech.com/';
$endpoint = '/wc-auth/v1/authorize';
$params = [
    'app_name' => 'Eastern Fullfillment',
    'scope' => 'write',
    'user_id' => 123,
    'return_url' => 'https://dev.easternfulfillment.com/woo/connect/response/',
    'callback_url' => 'https://dev.easternfulfillment.com/woo/connect/callback/'
];
$query_string = http_build_query( $params );

return Redirect::away($store_url . $endpoint . '?' . $query_string);

});

Route::any('/woo/connect/response/', function () {
return redirect('dashboard');
});


Route::any('/woo/connect/callback/', function () {
return redirect('dashboard');
});

It throws following error

response[code] => 419

0 likes
1 reply
tykus's avatar
tykus
Best Answer
Level 104

WooCommerce is making a POST request I suppose?

You can exclude the URI from CSRF verification, to prevent the framework attempting to handle it like a Request coming from within your application. Depending on your Laravel version, this can be implemented differently

Please or to participate in this conversation.