Skip to content

Commit 0efd927

Browse files
committed
Add client_id to accounts/oauth_access_token
1 parent d71ecbb commit 0efd927

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/class-convertkit-api-v4.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ public function get_access_token_by_api_key_and_secret( $api_key, $api_secret )
492492
array(
493493
'api_key' => $api_key,
494494
'api_secret' => $api_secret,
495+
'client_id' => $this->client_id,
495496
)
496497
);
497498

tests/wpunit/APITest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,22 @@ public function testGetAccessTokenByInvalidAPIKeyAndSecret()
604604
$this->assertEquals('Authorization Failed: API Secret not valid', $result->get_error_message());
605605
}
606606

607+
/**
608+
* Test that fetching an Access Token using an invalid client ID returns a WP_Error.
609+
*
610+
* @since 2.0.7
611+
*/
612+
public function testGetAccessTokenByAPIKeyAndSecretWithInvalidClientID()
613+
{
614+
$api = new ConvertKit_API_V4( 'invalidClientID', $_ENV['CONVERTKIT_OAUTH_REDIRECT_URI'] );
615+
$result = $api->get_access_token_by_api_key_and_secret(
616+
$_ENV['CONVERTKIT_API_KEY'],
617+
$_ENV['CONVERTKIT_API_SECRET']
618+
);
619+
$this->assertInstanceOf(WP_Error::class, $result);
620+
$this->assertEquals($result->get_error_code(), $this->errorCode);
621+
}
622+
607623
/**
608624
* Test that supplying valid API credentials to the API class returns the expected account information.
609625
*

0 commit comments

Comments
 (0)