Home > Software engineering >  The user logged out after redirecting from the payment gateway
The user logged out after redirecting from the payment gateway

Time:08-07

I have a store website built with laravel 8.x. When my user went to the payment gateway and redirect to the website(even if the payment succeeded or failed) all sessions cleared, and the user is logged out from their area.

The payment gateway redirect to my website with the POST method, I simulate the condition with the GET method but it works, but in the POST redirection all session was cleared.

I have already added callback URL to VerifyCsrfToken middleware:

protected $except = [
    'logout',
    'callback',
];

My callback route is like below:

Route::post('/callback', [PaymentController::class, 'callback']);

And in the callback method user auth is not provided yet:

public function callback(Request $request) {
    dd(auth('organ')->check());
}

The result was:

false

CodePudding user response:

The problem is about the SameSite cookie, please read this in this URL.

Also remember that where you set the same_site attribute to none, you must set secure to true.

  • Related