docs: reinstate WordPress.com OAuth2 setup for contributors - #23288
docs: reinstate WordPress.com OAuth2 setup for contributors#23288dcalhoun wants to merge 3 commits into
Conversation
Values in a Git-ignored `secrets.properties` at the root of the repository now take precedence over `defaults.properties`, as well as over any secrets applied by `configure_apply`. Keys the file leaves out keep their existing value, so it only needs the entries being overridden. This gives contributors a place to put their own WordPress.com OAuth2 credentials that isn't a tracked file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HSP5MJmVBoiqtwBhaa4eHo
The instructions were removed in #20928 because passkey-related API changes had broken the WordPress.com authentication flow. The rebuilt web-based login works again, so document the setup in `docs/wpcom-authentication.md`: registering an application, adding both `wordpress://wpcom-authorize` and `jetpack://wpcom-authorize` as redirect URLs, and supplying the credentials via `secrets.properties`. Registering both redirect URLs is the step the previous instructions did not cover, since the flow now returns to the app through a URL scheme that differs per app and WordPress.com matches the redirect exactly. Also drops the note claiming WordPress.com access is disabled in development. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HSP5MJmVBoiqtwBhaa4eHo
Only `[1]` and `[8]` are referenced, both from the Google Configuration section. The rest are leftovers: `[5]`, `[6]` and `[7]` belonged to the OAuth2 section removed in #20928, and the body links to Android Studio and the WordPress Slack inline rather than through `[3]` and `[4]`. Link reference definitions render as nothing, so this does not change the page. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HSP5MJmVBoiqtwBhaa4eHo
|
|
|
|
ParaskP7
left a comment
There was a problem hiding this comment.
👋 @dcalhoun !
I have reviewed and tested this PR as per the instructions, everything works as expected, good job and thank YOU! 🌟 x 🌟 ^ 🌟
I verified the override reaches BuildConfig with our secrets applied, so a local secrets.properties does take precedence over ~/.configure/wordpress-android/secrets/secrets.properties. The documented setup also matches what we worked through in the thread back in July, both redirect URLs and both apps. And the README reference-definition cleanup is safe, [1] and [8] are the only ones left and both are still pointed at.
I have left a question (❓) below for you to consider. I am going to approve this PR anyway, since it is not blocking. I am NOT going to merge this PR yet to give you some time to reply. However, feel free to ignore it and merge the PR yourself.
Question (❓): Mostly so that we have it stated explicitly and in writing, is the precedence deliberate? That is, a local secrets.properties overriding the secrets applied by configure_apply, rather than only filling in when those are absent. I am fairly confident it is, since testing step 2 asks to verify the override "even with our secrets applied", and it is what lets one of us try our own OAuth2 application without relocating ~/.configure/wordpress-android the way you did in July. So this is a confirmation request, not a change request.
FYI: Alternative
For reference, the alternative would be to make the local file a fallback-only overlay, so applied secrets can never be shadowed, though it would cost you exactly that "even with our secrets applied" path:
static def loadSecrets(Logger logger, File defaultsFile, File secretsFile, File localSecretsFile) {
if (secretsFile.exists()) {
return loadPropertiesFromFile(secretsFile)
}
logger.warn("Secrets file not found. Using defaults.")
def properties = loadPropertiesFromFile(defaultsFile)
if (localSecretsFile.exists()) {
logger.lifecycle("Applying local secret overrides from ${localSecretsFile.name}.")
properties.putAll(loadPropertiesFromFile(localSecretsFile))
}
return properties
}

Description
WordPress.com OAuth2 documentation was removed in #20928 because passkey-related API changes had broken the authentication flow for anyone building without our secrets. Now that login is rebuilt on a web-based authorization flow, external contributors can register their own WordPress.com application and sign in again, so this reinstates the documentation — and adds the Git-ignored configuration file it needs.
Three commits:
build:settings.gradlenow layers a Git-ignoredsecrets.propertiesat the root of the repository over whichever base applies, so values there take precedence overdefaults.propertiesand over any secrets applied byconfigure_apply. Keys the file leaves out keep their existing value, so it only needs the entries being overridden. Previously the only place to changewp.oauth.app_idwasdefaults.properties, a tracked file — an easy way for a contributor to commit their client secret by accident.secrets.properties-exampleis the copy target and.gitignorecovers the copy.docs:docs/wpcom-authentication.mddocuments the setup, with pointers from the README and the docs index. The step the old instructions did not cover is registering bothwordpress://wpcom-authorizeandjetpack://wpcom-authorizeas Redirect URLs: the flow now returns to the app through a URL scheme that differs per app, and WordPress.com only redirects to an exact match. This also drops the README's "Access to WordPress.com features is temporarily disabled in the development environment" note, which is no longer true.docs:removes five link reference definitions in the README that nothing points at.[5],[6]and[7]belonged to the OAuth2 section Replaces OAuth2 section with self-hosted test instructions #20928 removed; the body links to Android Studio and the WordPress Slack inline rather than through[3]and[4]. Link reference definitions render as nothing, so the page is unchanged.The Gradle change is the part worth the closest look, since it alters secret precedence for everyone rather than only for contributors.
Internal context: p1784211249505409-slack-C04PWEZSYFL
Testing instructions
Verify the override reaches
BuildConfig(no WordPress.com application needed):secrets.propertiesin the root of the repository containingwp.oauth.app_id = test_client_id_12345../gradlew :WordPress:generateJetpackDebugBuildConfig.Applying local secret overrides from secrets.properties.OAUTH_APP_IDinWordPress/build/generated/source/buildConfig/jetpack/debug/org/wordpress/android/BuildConfig.javaistest_client_id_12345, even with our secrets applied.secrets.propertiesand run the task again.OAUTH_APP_IDis back to its usual value, and thatgit statusnever listedsecrets.properties.Verify the documented setup end to end, ideally with our secrets disabled so you are on the contributor path:
docs/wpcom-authentication.mdwith a WordPress.com application of your own, registering both redirect URLs.jetpackDebug, then choose "Log in or sign up with WordPress.com".wordpressDebug.Read the rendered README and docs index.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HSP5MJmVBoiqtwBhaa4eHo