Verbum Comments: enable social login inside the iframe via Storage Access API - #50397
Verbum Comments: enable social login inside the iframe via Storage Access API#50397arcangelini wants to merge 5 commits into
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
ec98ecd to
3361e93
Compare
Proposed changes
Follow-up to #50396. Verbum runs in a third-party iframe (
jetpack.wordpress.com) embedded in the site's own domain, so it can't read or write the.wordpress.comauth cookies — which is why social login is suppressed there. This uses the Storage Access API to try to restore first-party cookie access, so WordPress.com / Facebook login can work inside the comment iframe on Atomic/Jetpack sites.useSocialLogin: on the login click, open the popup first and then calldocument.requestStorageAccess()without awaiting it. Both want the user gesture, and the popup is the one that breaks visibly without it.logged-out: render the social buttons in the iframe even when the cookie test currently fails, so there is something to click. Verbum Comments: fix blocked commenting from cookies #50396's top-level login link stays on offer alongside them, and the guest form is suppressed whenever login is required (it would be rejected on submit).Nothing here weakens
comment_registration— when it works, the visitor gets a real WordPress.com session and WP.com signs the identity server-side.Why cookie access has to actually be granted
If the session isn't readable on
jetpack.wordpress.comwhen the form POSTs, WP.com'sprocess_remote_comment_form_hc_post_as()falls through fromcase 'wordpress'to thedefaultbranch and rewriteshc_post_astoguest. The site then rejects the comment with "you must be logged in". So a denied prompt is not a soft degradation — the login silently does not count.That's why this PR no longer flips
userLoggedInon a bareaccess_token: showing someone as logged in when the POST will be downgraded just moves the dead end to after they've logged in. If access is denied the visitor stays logged out and still has the login link.Related product discussion/links
Does this pull request change what data or activity we track or use?
No. It requests browser storage access to read existing first-party auth cookies; no new data is collected.
Testing instructions
comment_registrationoff: the guest form should still be available as it is today.Still needs verifying before this is trusted
jetpack.wordpress.com, a cross-site navigation. If the storage-access grant doesn't cause the session cookie to be attached to that request,is_user_logged_in()is false on WP.com and step 5 fails even though the prompt was allowed. This needs checking in Chrome, Safari and Firefox — it is the assumption the whole approach rests on.