Jetpack Connect URL: use correct URL to auto-approve#8881
Conversation
…g customer know they've already connected the site. `auth_approved` is a connection URL param that let's a connecting customer skip the screen that shows the terms-of-service-acceptance button. In #8544 we meant to use `auth_approved`
|
Couldn't reproduce this the first times... And then I found a way to reproduce which is:
Then tested with this PR and didn't see that ^ behaviour. |
oskosk
left a comment
There was a problem hiding this comment.
Approving because this actually fixes a bug which results in a dead end.
|
I now got to see the step skipped after trying multiple times and going back and forward... The only thing that made it work, was switching branches on Jetpack Beta from this branch to Bleeding Edge and back. After that, clicking the Setup Jetpack button I got to skip the authorize screen... |
sirreal
left a comment
There was a problem hiding this comment.
It seems that this is the problem.
Thanks @roccotripaldi !
|
I spent some time tracking down why this only happens before connection has been attempted. Here's the short version: The connection banner naïvely adds a query arg to the jetpack/class.jetpack-connection-banner.php Lines 82 to 87 in b33be10 The URL may be WP Admin, which is required to get a Lines 4428 to 4432 in b33be10 That's why you must hit the endpoint at WP Admin once before this bug manifests. The WP Admin endpoint silently discards unknown params and rebuilds the connection URL for redirection. Ideally this param would be part of I've pushed a commit to maintain the param through the WP Admin redirection (d8e7a6c) See p1519119812000072-slack-luna |
This banners may include `auth_approved` which is intended to be sent to the connection API endpoint. Ensure relevant `auth_approved` params are included if provided when redirecting to the connection endpoint.
a017ea1 to
d8e7a6c
Compare
sirreal
left a comment
There was a problem hiding this comment.
I've tested and this works well, on first (WP Admin) and subsequent (jetpack.wordpress.com) auths.
I do think that the logic should be moved into build_connect_url.
@tyxla what do you think about it? Something similar happened with the onboarding param, but in this case it was problematic when the logic was inside build_connect_url() and we ended up pulling it out. |
|
@oskosk it was problematic because we were adding some extra parameters every time the user has an onboarding token. That's not the case here, so it looks safe from that point of view 👍 I'd only be hesitant to introduce it to So, if we decide to move it to |
* update changelog.txt * Update readme.txt with scaffolding for 5.9 changelog and release draft shortlink * Add changelog entry for #8243 * Add changelog entry for #8296 * Add changelog entry for #8367 * Add changelog entry for #8686 * Add changelog entry for #8707 * Add changelog entry for #8709 and #8714 * Add changelog entry for #8729 * Add changelog entry for #8777 * Add changelog entry for #8780 * Add changelog entry for #8786 * Add changelog entry for #8787 * Add changelog entry for #8801 #8805 #8832 #8865 and #8804 * Add changelog entry for #8817 * Add changelog entry for #8822 * Add changelog entry for #8823 * Add changelog entry for #8829 * Add changelog entry for #8834 * move some items to major enhancements * Add changelog entry for #8836 * Add changelog entry for #8839 * Add changelog entry for #8861 * Add changelog entry for #8862 * Add changelog entry for #8863 * Add changelog entry for #8866 * Add changelog entry for #8870 * Add changelog entry for #8874 * Add changelog entry for #8875 * Add changelog entry for #8881 * Add changelog entry for #8890 * Add changelog entry for #8911 * Add changelog entry for #8927 * Add changelog entry for #8931 * Add changelog entry for #8933 * Add changelog entry for #8930 * fix wording * typo * minor fixes * replace partner scripts for Jetpack Start in changelog entry * Update to-test.md * Update to-test.md * minor style fixes to to-test.md * minor style fixes to to-test.md * minor fixes on to-test.md * Add changelog entry for #8868 * Add changelog entry for #8844 * Add changelog entry for #8664 * Add changelog entry for #8935 * Add changelog entry for #8425 * Add changelog entry for #8625

already_authorizedis a connection URL param that lets a connecting customer know they've already connected the site.auth_approvedis a connection URL param that let's a connecting customer skipthe screen that shows the terms-of-service-acceptance button.
In #8544 we meant to use
auth_approvedFixes #8783
To reproduce:
On an unconnected jetpack site, try connecting from the banner on the plugins page. Not that you get an odd "Already connected..." error when you land on wordpress.com
Then apply this patch to your jetpack site, and try again from the banner on the plugins page. You will not see the error, and you should skip the terms-of-service-acceptence and be auto authorized.
Proposed changelog entry for your changes:
We fixed an issue that sometimes resulted in a notice being shown about another user already having connected a Jetpack site when attempting to connect your site to WordPress.com