Yoast\WP\SEO\MyYoast_Client\Domain
Token_Set::from_response
Creates a Token_Set from a token endpoint response.
Per RFC 8707 §3 the AS may echo a resource field to confirm the audience it minted the token for. The spec does not require the client to honour the echo, and trusting an unverified echo into storage could later violate §2 on refresh. We deliberately ignore the echoed field; the caller is expected to stamp the requested indicator via with_resource_indicator().
Метод класса: Token_Set{}
Хуков нет.
Возвращает
self.
Использование
$result = Token_Set::from_response( $response ): self;
- $response(массив) (обязательный)
- .
Код Token_Set::from_response() Token Set::from response Yoast 28.3
public static function from_response( array $response ): self {
if ( empty( $response['access_token'] ) || ! \is_string( $response['access_token'] ) ) {
throw new InvalidArgumentException( 'Token response is missing a valid access_token.' );
}
$expires_in = (int) ( $response['expires_in'] ?? 900 );
return new self(
$response['access_token'],
( \time() + $expires_in ),
( $response['token_type'] ?? Auth_Token_Type::DPOP ),
( $response['refresh_token'] ?? null ),
( $response['id_token'] ?? null ),
( $response['scope'] ?? null ),
);
}