Skip to content

Conversation

@n7studios
Copy link
Contributor

Summary

Adds the WordPress hooks convertkit_api_get_access_token_error, convertkit_api_refresh_token_error and convertkit_api_access_token_invalid, which Kit Plugins may use to e.g. delete invalid access/refresh tokens from their Plugin settings.

Removes the is_production_site check, so that non-production sites may automatically refresh expired access tokens. This check was introduced in this PR in September 2024, as a workaround prior to the tenant_name support which was added in November 2024. As such, it's no longer needed, as each site is issued its own tokens.

Testing

Existing tests pass.

Checklist

This was used to prevent refreshing tokens on non-production sites, prior to the tenant_name option which allowed different tokens to be issued to the same client + oauth user on different sites
@n7studios n7studios self-assigned this Nov 10, 2025
@n7studios n7studios added the enhancement New feature or request label Nov 10, 2025
…cess token is used

Otherwise a 401 for e.g. member content will result in the access token wrongly being removed, when it’s a valid access token.
@n7studios n7studios requested review from a team, corydhmiller and noelherrick and removed request for a team November 11, 2025 11:58
@n7studios n7studios marked this pull request as ready for review November 11, 2025 11:58
Copy link

@noelherrick noelherrick left a comment

Choose a reason for hiding this comment

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

Makes sense, but in our own consumers, we need to check to make sure we're only deleting the tokens when the Kit service says they're invalid or expired, not if there's a rate limit or a 5xx error.

@n7studios n7studios merged commit 588e3ed into main Nov 17, 2025
20 of 23 checks passed
@n7studios n7studios deleted the add-hooks-on-request-error branch December 5, 2025 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants