Skip to content

Revoke and Remove Tokens on Disconnect#1064

Merged
n7studios merged 9 commits intomainfrom
revoke-access-token
Apr 9, 2026
Merged

Revoke and Remove Tokens on Disconnect#1064
n7studios merged 9 commits intomainfrom
revoke-access-token

Conversation

@n7studios
Copy link
Copy Markdown
Contributor

@n7studios n7studios commented Apr 7, 2026

Summary

When the user clicks the Disconnect button at Settings > Kit:

  • Revokes the access and refresh tokens by calling the oauth/revoke endpoint
  • Removes the v3 API Key, v3 API Secret, v4 Access Token, v4 Refresh Token and v4 Token Expires settings from the database

Testing

  • testCredentialsAndResourcesAreDeletedOnDisconnect: end to end test confirming that the API Key, Secret, Access Token and Refresh Token are deleted from the Plugin.
  • testCredentialsDeletedAndInvalidWhenRevoked: integration test confirming that the credentials are deleted from the Plugin and no longer work i.e. are revoked, when the API's revoke_tokens method is called.

Checklist

@n7studios n7studios self-assigned this Apr 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

WordPress Playground

🚀 Your PR has been built and is ready for testing in WordPress Playground!

Click here to test your changes in WordPress Playground

@n7studios n7studios requested review from a team, ciccio-kit and noelherrick and removed request for a team April 7, 2026 06:17
@n7studios n7studios marked this pull request as ready for review April 7, 2026 06:17
@n7studios n7studios changed the title Revoke Access Token on Disconnect Revoke and Remove Tokens on Disconnect Apr 8, 2026
@n7studios n7studios requested a review from noelherrick April 8, 2026 02:46
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

WordPress Playground

🚀 Your PR has been built and is ready for testing in WordPress Playground!

Click here to test your changes in WordPress Playground

// If another Kit Plugin is active and out of date, its libraries might
// be loaded that don't have this method.
if ( ! method_exists( $api, 'revoke_tokens' ) ) { // @phpstan-ignore-line Older WordPress Libraries won't have this function.
$this->output_error( __( 'The Kit WordPress Libraries is missing the `revoke_tokens` method. Please update all Kit WordPress Plugins to their latest versions, and click Disconnect again.', 'convertkit' ) );
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nice error message, thank you!

These are now published and include the `revoke_tokens` method.
2.1.4 results in composer loading the old cached version from 2 weeks ago. Bumped to 2.1.5 to resolve.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

WordPress Playground

🚀 Your PR has been built and is ready for testing in WordPress Playground!

Click here to test your changes in WordPress Playground

@n7studios n7studios merged commit 86286ed into main Apr 9, 2026
223 of 239 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants