Use Kit Account ID as WPForms Provider Key #69
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When completing OAuth, credentials are stored in WPForms using
wpforms_update_providers_options
, with a random ID as the key.If a user disconnects and then connects the same Kit account (most likely as a workaround for the access token issue in the v4 API), this results in a different random ID as the key for the stored credentials.
As a result, any configuration stored in Forms is lost, as WPForms maps configurations to the keys in
wpforms_update_providers_options
.This PR resolves by using the Kit account ID as the key when storing credentials, ensuring that any configuration at Form level remains mapped to the correct Kit account, without any loss of configuration and saving users having to reconfigure the Kit integration on each WPForms Form.
This doesn't resolve the issue of the same access and refresh token issuance to multiple sites using the same Kit account, which is covered by PLAT-2262 - rather, it is a way to reduce friction should a creator need to disconnect and connect a Kit account manually for the time being.
Testing
testConnectionRetainedWhenAccountReconnected
: Tests that an existing Kit configuration on a WPForms Form is retained when an OAuth connection is added, removed and added again.Checklist