Skip to content

Commit

Permalink
Merge pull request #610 from leepeuker/fix-pwa-session-expiration
Browse files Browse the repository at this point in the history
Update auth cookie settings to fix PWA losing cookie after restart
  • Loading branch information
leepeuker authored Aug 21, 2024
2 parents 0a764f3 + a8ebe96 commit e225ab2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Domain/User/Service/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,13 @@ public function setAuthenticationCookieAndNewSession(int $userId, string $token,
{
$this->sessionWrapper->destroy();
$this->sessionWrapper->start();
setcookie(self::AUTHENTICATION_COOKIE_NAME, $token, [
'expires' => (int)$expirationDate->format('U'),
'path' => '/',
'domain' => '',
'secure' => false,
'httponly' => true,
'samesite' => 'strict'
]);
setcookie(
self::AUTHENTICATION_COOKIE_NAME,
$token,
(int)$expirationDate->format('U'),
'/',
httponly: true
);

$this->sessionWrapper->set('userId', $userId);
}
Expand Down

0 comments on commit e225ab2

Please sign in to comment.