Skip to content

Commit

Permalink
Docs: Fix state check example if session variable is not set (#946)
Browse files Browse the repository at this point in the history
Co-authored-by: Frank Stuckenberg <[email protected]>
  • Loading branch information
Strelox and Frank Stuckenberg authored Apr 16, 2023
1 parent d4bcb32 commit 04041d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if (!isset($_GET['code'])) {
exit;

// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || (isset($_SESSION['oauth2state']) && $_GET['state'] !== $_SESSION['oauth2state'])) {
} elseif (empty($_GET['state']) || empty($_SESSION['oauth2state']) || $_GET['state'] !== $_SESSION['oauth2state']) {

if (isset($_SESSION['oauth2state'])) {
unset($_SESSION['oauth2state']);
Expand Down

0 comments on commit 04041d3

Please sign in to comment.