Skip to content
Draft
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
15 changes: 9 additions & 6 deletions includes/oauth/class-authorization-code.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,14 @@ public static function create(
/**
* Exchange authorization code for tokens.
*
* @param string $code The authorization code.
* @param string $client_id The client ID.
* @param string $redirect_uri The redirect URI (must match original).
* @param string $code_verifier The PKCE code verifier.
* @param string $code The authorization code.
* @param string $client_id The client ID.
* @param string $redirect_uri The redirect URI (must match original).
* @param string $code_verifier The PKCE code verifier.
* @param string|null $dpop_jkt Optional DPoP JWK thumbprint for proof-of-possession binding.
* @return array|\WP_Error Token data or error.
*/
public static function exchange( $code, $client_id, $redirect_uri, $code_verifier ) {
public static function exchange( $code, $client_id, $redirect_uri, $code_verifier, $dpop_jkt = null ) {
$code_hash = self::hash_code( $code );
$transient = self::TRANSIENT_PREFIX . $code_hash;
$code_data = \get_transient( $transient );
Expand Down Expand Up @@ -168,7 +169,9 @@ public static function exchange( $code, $client_id, $redirect_uri, $code_verifie
return Token::create(
$code_data['user_id'],
$client_id,
$code_data['scopes']
$code_data['scopes'],
Token::DEFAULT_EXPIRATION,
$dpop_jkt
);
}

Expand Down
Loading
Loading