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

hain2901's avatar

Session has expired!?

Hi everybody,

I am using jwt_auth for my route on laravel API. Everything works well with GET method but POST. I always got the message "419 - Sorry, your session has expired. Please refresh and try again. " when using POST method in postman, things didn't happen with GET method.

Here is my route:

Route::prefix('api/v1')->middleware('jwt.auth')->group(function() { Route::get('transactions', 'TransactionController@getTransaction');

    Route::get('transactions/{id}', 'TransactionController@getTransactionById')->where('id', '[0-9]+');

    Route::post('transactions', 'TransactionController@postTransaction');
});

I am using "Authorization:Bearer {{jwt_token}}" as my request's header. Please let me know how to solve this problem!

Best regards, Hai

0 likes
3 replies
hain2901's avatar

I am using laravel version 5.7. I still use same syntax of routing on other project based on laravel version 5.6. I don't know how to solve this problem

https://prnt.sc/l6ra8i

tykus's avatar

If those routes are subject to the VerifyCsrf middleware, e.g. in web route group, then a CSRF token is expected

hain2901's avatar

http://prntscr.com/l6wr05

Based on the above image, GET method of transaction is also in web route group, isn't it? But it still work but POST method of transaction. Btw, how can I get CSRF token to add it on header of request?

Thanks, Hai

Please or to participate in this conversation.