File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -385,6 +385,16 @@ public function authenticate(): bool
385385 if (isset ($ _REQUEST ['code ' ])) {
386386
387387 $ code = $ _REQUEST ['code ' ];
388+
389+ // Do an OpenID Connect session check
390+ if (!isset ($ _REQUEST ['state ' ]) || ($ _REQUEST ['state ' ] !== $ this ->getState ())) {
391+ throw new OpenIDConnectClientException ('Unable to determine state ' );
392+ }
393+
394+ // Cleanup state
395+ $ this ->unsetState ();
396+
397+ // Request token from the server using the code
388398 $ token_json = $ this ->requestTokens ($ code );
389399
390400 // Throw an error if the server returns one
@@ -395,14 +405,6 @@ public function authenticate(): bool
395405 throw new OpenIDConnectClientException ('Got response: ' . $ token_json ->error );
396406 }
397407
398- // Do an OpenID Connect session check
399- if (!isset ($ _REQUEST ['state ' ]) || ($ _REQUEST ['state ' ] !== $ this ->getState ())) {
400- throw new OpenIDConnectClientException ('Unable to determine state ' );
401- }
402-
403- // Cleanup state
404- $ this ->unsetState ();
405-
406408 if (!property_exists ($ token_json , 'id_token ' )) {
407409 throw new OpenIDConnectClientException ('User did not authorize openid scope. ' );
408410 }
You can’t perform that action at this time.
0 commit comments