Skip to content

feat: add prompt to project OAuth2 provider settings - #13905

Merged
Meldiron merged 6 commits into
mainfrom
feat-oauth2-prompt
Sep 25, 2026
Merged

Meldiron merged 6 commits into
mainfrom
feat-oauth2-prompt

Conversation

@Meldiron

@Meldiron Meldiron commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a prompt setting to the project OAuth2 config of every provider that documents a prompt authorize parameter. Google and OIDC already had one, and this follows the same pattern:

Provider Endpoint Values Multiple values
Auth0 updateOAuth2Auth0 none, login, consent space-joined
Discord updateOAuth2Discord none, consent one only
GitHub updateOAuth2GitHub select_account one only
Kakao updateOAuth2Kakao none, login, create, select_account comma-joined, per Kakao docs
Microsoft updateOAuth2Microsoft none, login, consent, select_account one only
Okta updateOAuth2Okta none, login, consent space-joined
Salesforce updateOAuth2Salesforce login, consent space-joined
Zoho updateOAuth2Zoho consent one only

In every case none has to be the only value. An empty array goes back to the provider's default. Each provider's response model returns prompt, and the console OAuth2 provider metadata lists it as a parameter. The adapter adds prompt to the authorize URL only when it's set.

Implementation

  • The project Base action gets getPromptValues(). A provider that returns values gets the prompt param, SDK enum ProjectOAuth2{Provider}Prompt, a generated description, the response field and the updateWithPrompt callback. That covers Discord, GitHub, Kakao, Salesforce and Zoho.
  • Auth0, Microsoft and Okta already have their own handlers that store a JSON secret, so they add prompt to that JSON.
  • Discord, GitHub, Kakao, Salesforce and Zoho used to store the client secret as a plain string. It's now stored as JSON ({clientSecret, prompt}), like Google. Their adapters still accept a plain-string secret, so existing projects, and the VCS GitHub app that passes a plain secret, keep working without a migration. Token requests and verifyCredentials now read the secret through getClientSecret().

Community request: prompt=none for Discord, so users who already authorized the app skip Discord's authorization screen. Discord's docs describe prompt as controlling "how the authorization flow handles existing authorizations". They don't say what none does for a first-time user, so that should be checked against a real Discord app before merging.

Follow-ups

  • utopia-php/migration allow-lists which OAuth2 fields get migrated. It copies Google's prompt but not the new ones, so migrations will drop them until that list is updated.
  • Zoho's adapter throws a TypeError when the token response has no id_token. That behavior predates this PR and is out of scope. The unit test fake returns an id_token.

Test Plan

  • Unit tests in tests/unit/Auth/OAuth2/ for Auth0, Discord, GitHub, Kakao, Microsoft, Okta, Salesforce and Zoho: the login URL includes prompt only when set, with each provider's separator. For the providers that switched to JSON, the token request sends the real client secret for both plain and JSON secrets. All 93 OAuth2 unit tests pass locally.
  • I built each Update action locally to check that the param order matches its callback, and that providers without prompt support keep the original action().
  • E2E test testUpdateOAuth2Prompt runs for every provider above: the prompt is saved and read back, an empty array clears it, and an unknown value returns 400. For providers that don't verify credentials against their real API when enabled (Auth0, Discord, Okta, Salesforce, Zoho), it also checks that GET /v1/account/sessions/oauth2/:provider sends the prompt in its redirect. testUpdateOAuth2PromptNoneMustBeAlone covers the none rule. ConsoleConsoleClientTest now expects GitHub's third prompt parameter. The e2e tests haven't been run locally; they'll first run in CI.
  • Pint, PHPStan and Rector pass on the changed files.

Related PRs and Issues

🤖 Generated with Claude Code

@greptile-apps

greptile-apps Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds prompt parameter to OAuth2 provider login flows.

The PR appears safe to merge based on the changes since the previous review.

Summary

Adds configurable OAuth2 authorization prompts for eight providers, exposes them in project responses and console metadata, and updates adapters and tests to support JSON-stored credentials while retaining plain-secret compatibility.

  • The changes since the previous review tighten client-secret validation and add an E2E check for enabling without a secret.

Reviews (4) · Last reviewed commit: "fix: require a client secret inside JSON..."

Comment thread app/controllers/api/account.php Resolved
Comment thread tests/unit/Auth/OAuth2Test.php Resolved
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → feat-oauth2-prompt (after).

Metric Before After Change
🚀 Requests/sec 180.82 184.59 ⚪ +2.1%
⏱️ Latency P50 95.92 ms 94.44 ms ⚪ -1.5%
⏱️ Latency P95 225.24 ms 221.2 ms ⚪ -1.8%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 94.44 221.2 11,514 184.59 -4.04
Account 186.37 339.88 606 10.03 -41.29
TablesDB 90.97 167.89 6,262 102.02 -4.31
Storage 87.61 185.24 3,030 51.32 -7.05
Functions 133.48 261 1,616 28.08 -9.28

Top API waits (after)

API request Max wait (ms)
account.name.update 613.81
account.prefs.update 457.67
storage.files.create 420.38
functions.variables.update 384.83
tablesdb.rows.update 379.96

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Meldiron Meldiron changed the title feat: add prompt param to OAuth2 session and token endpoints feat: add prompt to project OAuth2 Discord settings Sep 25, 2026
@Meldiron Meldiron changed the title feat: add prompt to project OAuth2 Discord settings feat: add prompt to project OAuth2 provider settings Sep 25, 2026
Meldiron and others added 3 commits September 25, 2026 11:36
@Meldiron
Meldiron merged commit 04b6fcf into main Sep 25, 2026
49 checks passed
@HarshMN2345 HarshMN2345 mentioned this pull request Oct 12, 2026
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant