I am using CI version 3.1.13 and PHP 7.4.33 to develop my webapp. I am using CyberSource payment gateway for online payments, but when user is getting redirected back from CyberSource to the webapp then the session is getting lost.
Below is the process
User Login => Select Package => Enter credit card details (POST data to CyberSource) => Redirect back from CyberSource POST data (now user login session is lost and user is redirected back to the login page due to lost session)
I have faced this issue 2 times in the past but wasn't able to find any promising solution and have to apply custom patch to resolve this (saving serialized session array to a temp database table and retrieving the session array from the temporary table if the session is lost)
Below is what I have tried so far without any proper resolution
- https://stackoverflow.com/a/50792059/1835912
Go to system/libraries/Session/session.php at Line no 281 and replace ini_set('session.name', $params['cookie_name']); by ini_set('session.id', $params['cookie_name']);
this resolves the issue in FireFox but not in Chrome - https://stackoverflow.com/a/66354648/1835912
You should use SameSite=None on your cookies attributes. Also if you use SameSite=None you should set the secure cookies attribute as well.
$config['cookie_secure'] = FALSE; // if is not under https, or true if you use https
$config['cookie_path'] = '/;SameSite=None';$config['cookie_secure'] = TRUE;
- Tried changing PHP version to 7.1, 7.2, 7.3 and 8.1 (same issues for all these versions)
- My webapp runs on secure protocol HTTPS and the cybersource return URL also has HTTPS
- Followed this step by step youtube video: https://www.youtube.com/watch?v=j6jBxlrhTY4
Do anyone know any proper resolution for this, thanks in advance!