Skip to content

Add revoke_tokens method#115

Merged
n7studios merged 4 commits intomainfrom
add-revoke-token-method
Apr 9, 2026
Merged

Add revoke_tokens method#115
n7studios merged 4 commits intomainfrom
add-revoke-token-method

Conversation

@n7studios
Copy link
Copy Markdown
Contributor

@n7studios n7studios commented Apr 7, 2026

Summary

Adds the revoke_tokens method, allowing Kit Plugins to revoke an access token when e.g. the user disconnects the Plugin from Kit.

Testing

  • testRevokeTokens tests the revoke_tokens method revokes the access and refresh tokens

Checklist

@n7studios n7studios requested review from a team, ciccio-kit, mercedesb and noelherrick and removed request for a team April 7, 2026 04:36
*/
public function revoke_token() {

$result = $this->post(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mercedesb this will POST to https://api.kit.com/v4/oauth/revoke, sending the client_id and access_token to be revoked. Wanted to check this is the correct call, as couldn't spot any docs on the API site.

@n7studios n7studios marked this pull request as ready for review April 7, 2026 04:37
'revoke',
array(
'client_id' => $this->client_id,
'access_token' => $this->access_token,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change this parameter to token - Doorkeeper will look for token parameter.

I think that you will also need to revoke refresh token separately - it should be enough to make same call and pass it as token parameter.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think client_secret is also needed here as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change this parameter to token - Doorkeeper will look for token parameter.

I think that you will also need to revoke refresh token separately - it should be enough to make same call and pass it as token parameter.

I've updated the PR to reflect this, and the associated test to confirm both access and refresh tokens are revoked by attempting to use them with authenticated requests/refreshing tokens.

I think client_secret is also needed here as well

The WordPress Plugins use PKCE, as the code is public (https://en-gb.wordpress.org/plugins/convertkit/) - so there's no client_secret used. I've confirmed with the changes above that tokens are revoked, so don't believe the client secret is needed.

@n7studios n7studios changed the title Add revoke_token method Add revoke_tokens method Apr 8, 2026
@n7studios n7studios changed the base branch from backport-php-7.4-support to main April 9, 2026 02:00
@n7studios n7studios merged commit b761658 into main Apr 9, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants