Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/KindeClientSDK.php
Original file line number Diff line number Diff line change
Expand Up @@ -834,15 +834,15 @@ private function getProtocol()
/**
* Checks the authentication state against the provided state from the server.
*
* @param string $stateServer The state received from the server.
* @param string|null $stateServer The state received from the server, or null if missing.
*
* @throws OAuthException If the authentication state is empty or does not match the provided state.
*/
private function checkStateAuthentication(string $stateServer)
private function checkStateAuthentication(?string $stateServer)
{
$storageOAuthState = $this->storage->getState();

if (empty($storageOAuthState) || $stateServer != $storageOAuthState) {
if (empty($stateServer) || empty($storageOAuthState) || $stateServer !== $storageOAuthState) {
throw new OAuthException("Authentication failed because it tries to validate state");
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/Sdk/KindeClientSDK.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,11 @@ private function getProtocol()
return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http";
}

private function checkStateAuthentication(string $stateServer)
private function checkStateAuthentication(?string $stateServer)
{
$storageOAuthState = $this->storage->getState();

if (empty($storageOAuthState) || $stateServer != $storageOAuthState) {
if (empty($stateServer) || empty($storageOAuthState) || $stateServer !== $storageOAuthState) {
throw new OAuthException("Authentication failed because it tries to validate state");
}
}
Expand Down