CMM-2149: Guide WordPress.com-connected sites to WordPress.com login#23106
CMM-2149: Guide WordPress.com-connected sites to WordPress.com login#23106adalpari wants to merge 8 commits into
Conversation
…gin flow When Application Password discovery fails on the "Enter your existing site address" screen, check connect-site-info and, if the site is hosted on WordPress.com, prompt the user to use "Continue with WordPress.com" instead of showing a dead-end error. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Generated by 🚫 Danger |
|
|
|
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #23106 +/- ##
=======================================
Coverage 37.63% 37.63%
=======================================
Files 2343 2343
Lines 127290 127316 +26
Branches 17655 17662 +7
=======================================
+ Hits 47903 47920 +17
- Misses 75464 75473 +9
Partials 3923 3923 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Replace the connect/site-info fallback with reading the authentication mechanism already returned by WpLoginClient.apiDiscovery(): WordPress.com sites report OAuth2, so route them to the WordPress.com login dialog instead of dead-ending on a generic Application Password error. Mirrors how the GutenbergKit demo app distinguishes WP.com from self-hosted sites. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When API discovery detects a WordPress.com site, send the user straight to the WordPress.com OAuth flow, matching the existing up-front WPUrlUtils.isWordPressCom() behavior. Drops the intermediate dialog and its now-unused strings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…wpcom-connected-sites
Fixes the Android Lint failure flagging the mock of the OAuth2Endpoints data class in the WpComSite discovery test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jkmassel
left a comment
There was a problem hiding this comment.
One thing we should make sure is part of this – self-hosted sites can also expose oauth as an authentication mechanism via plugins, so we should double-check that the domain for the URL is .wordpress.com – otherwise someone could use it as a vector to get our client ID and secret.
I see, so a self-hosted site allowing |
…ites Self-hosted sites can advertise OAuth2 via plugins, so treating any OAuth2 mechanism as WordPress.com is too broad. Additionally require the discovered OAuth2 authorization endpoint to be hosted on wordpress.com, so a self-hosted site can't be misclassified (and can't pose as WordPress.com to hijack the login flow). Adds Robolectric tests for the endpoint-host discrimination. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@jkmassel I've fixed the problem by checking the oauth uthroization URL as well. The fix prevents the false wpcom-positive. I don't think there was any vector leak, though. Please give it another round. |


Description
On the "Enter your existing site address" login screen (the Application Password flow),
users whose site is hosted on WordPress.com hit a generic dead-end error. WordPress.com
sites can't use Application Passwords, so the flow fails and the user gets no hint that they
should have used "Continue with WordPress.com". This caused support ticket #11413559 (two HE
replies to resolve).
The screen already redirects literal
*.wordpress.comURLs up front (WPUrlUtils.isWordPressCom),but not WordPress.com sites on custom/mapped domains (e.g.
mobile.blog), which look like anyother domain.
Approach
WpLoginClient.apiDiscovery()— which we already call to find the Application Passwordsendpoint — reports the site's authentication mechanism. WordPress.com sites advertise
OAuth2; self-hosted sites advertiseApplicationPasswords. We now read that signal insteadof assuming Application Passwords, and route WordPress.com sites straight to the WordPress.com
OAuth flow (the same destination as the existing up-front
isWordPressComcheck). This is howthe GutenbergKit demo app distinguishes the two, and it naturally covers custom-domain WP.com
sites without any extra network call.
Changes
ApplicationPasswordLoginHelper: addedDiscoveryResult.WpComSite; on a successfuldiscovery it checks
DiscoverSuccessWrapper.isWpComSite()(auth mechanism isOAuth2) andreturns
WpComSiteinstead of throwing on the missing Application Passwords URL.LoginSiteApplicationPasswordViewModel: emits awpComDetectedevent forWpComSite.LoginSiteApplicationPasswordFragment: onwpComDetected, opens the WordPress.com OAuthflow directly (
showWPcomLoginScreen), matching the existing static-check behavior.DiscoveryResultconsumers (My Site app-password cards, auto-auth dialog,app-password dialog) handle the new
WpComSitebranch as an unsupported/hidden case; theyonly run for already-added self-hosted sites, so it's effectively unreachable there.
OAuth2 → WpComSitemapping and theWpComSite → wpComDetectedevent.Android-only; the report notes iOS likely needs the same fix separately.
Linear: CMM-2149
Testing instructions
NOTE: test the following steps in the main screen "Log in form". This is "Enter your existing site address" CTA. Do not use the "Continue with Wordpress.com" CTA.
Self-hosted Application Password site
WordPress.com site on a
.wordpress.comdomainsomething.wordpress.comaddress.WordPress.com site on a custom domain (e.g.
https://mobile.blog/)Regression: