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

Use Kit Account ID as WPForms Provider Key #69

Merged
merged 4 commits into from
Nov 12, 2024

Conversation

n7studios
Copy link
Contributor

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

This ensures that individual Forms configured with Kit have their settings retained should the user disconnect and reconnect the same Kit Account at Settings > Integrations.  It’s likely they’ll do this with the v4 OAuth when using the same creator account on multiple sites, hitting a race condition where an access token expires.
@n7studios n7studios added the enhancement New feature or request label Nov 8, 2024
@n7studios n7studios self-assigned this Nov 8, 2024
@n7studios n7studios requested review from a team, noelherrick and jenessawhite and removed request for a team November 8, 2024 08:13
@n7studios n7studios marked this pull request as ready for review November 8, 2024 08:13
@n7studios n7studios mentioned this pull request Nov 11, 2024
6 tasks
@n7studios n7studios merged commit b2e0dd7 into main Nov 12, 2024
18 checks passed
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.

2 participants