-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
There was a problem hiding this 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.
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. |
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 whenWP_ENVIRONMENT_TYPE
is not production. Individual Plugins should also perform their own unit tests with these libraries to confirm the same.Checklist