Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check WordPress environment when automatically refreshing token #79

Merged
merged 10 commits into from
Sep 12, 2024

Conversation

n7studios
Copy link
Contributor

@n7studios n7studios commented Sep 9, 2024

Summary

When a call is made with an expired access token, checks the WordPress environment to determine if the WordPress Libraries should automatically attempt to refresh the expired access token.

If the environment is configured in the WordPress configuration file and is not a production site, no automatic attempt to refresh an expired access token will occur.

This is designed to mitigate this reported issue, where the same ConvertKit creator account used on both a staging and production site results in the staging site obtaining the new access token first, resulting in the production site unable to refresh the same expired access token. Whilst each site should receive its own unique access token when first going through the OAuth flow, this doesn't seem to be the case - possibly because of the special redirect URI we use.

Testing

  • testRefreshTokenWhenAccessTokenExpiredErrorOnNonProductionSite: Tests that the automatic attempt to refresh an expired access token does not occur when WP_ENVIRONMENT_TYPE is not production. Individual Plugins should also perform their own unit tests with these libraries to confirm the same.

Checklist

@n7studios n7studios added the bug Something isn't working label Sep 9, 2024
@n7studios n7studios self-assigned this Sep 9, 2024
@n7studios n7studios requested review from a team, noelherrick and corydhmiller and removed request for a team September 10, 2024 03:25
@n7studios n7studios marked this pull request as ready for review September 10, 2024 03:26
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.

@cainwatson Anything we can do here besides this solution? This seems like odd behavior.

@cainwatson
Copy link
Member

@cainwatson Anything we can do here besides this solution? This seems like odd behavior.

Hey! We're aware this is an issue, but I've unfortunately been OOO and other things have taken priority. If this temporarily mitigates the issue, go ahead and release. I'll make sure that when our PM gets back next week this is on his radar.

@n7studios n7studios merged commit 389a483 into main Sep 12, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants