Skip to content

Commit e55e4e0

Browse files
authored
Merge pull request #36 from Automattic/nonce_id_token_fix
copy over the nonce from parsed POST parameters to parsed GET parameters in $request object as a temporary fix. More context in PR description
2 parents 48515e6 + d061d40 commit e55e4e0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Http/Handlers/AuthorizeHandler.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ public function __construct( OAuth2Server $server, ConsentStorage $consent_stora
2222
}
2323

2424
public function handle( Request $request, Response $response ): Response {
25+
// Our dependency bshaffer's OAuth library currently has a bug where it doesn't pick up nonce correctly if it's a POST request to the Authorize endpoint.
26+
// Fix has been contributed upstream (https://github.com/bshaffer/oauth2-server-php/pull/1032) but it doesn't look it would be merged anytime soon based on recent activity.
27+
// Hence, as a temporary fix, we are copying over the nonce from parsed $_POST values to parsed $_GET values in $request object here.
28+
if ( isset( $request->request['nonce'] ) && ! isset( $request->query['nonce'] ) ) {
29+
$request->query['nonce'] = $request->request['nonce'];
30+
}
31+
2532
if ( ! $this->server->validateAuthorizeRequest( $request, $response ) ) {
2633
return $response;
2734
}

0 commit comments

Comments
 (0)