Skip to content

fix(oauth): make Box sign-in work - #15421

Merged
HarshMN2345 merged 8 commits into
mainfrom
fix-box-oauth-scope
Nov 9, 2026
Merged

HarshMN2345 merged 8 commits into
mainfrom
fix-box-oauth-scope

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Fixes #15371.

  • The adapter always requested manage_app_users, which Box only allows for server-side (JWT) apps. A user-authentication OAuth app gets invalid_scope: Unsupported scope was requested. and sign-in stops there. No scope is requested by default now, so Box grants the scopes configured on the app; custom scopes are joined with spaces, as Box expects. The token request no longer sends a scope.
  • The profile request went to https://api.box.com/2.0/me, which returns 404. It now uses /2.0/users/me.

Tested against a real Box OAuth 2.0 (user authentication) app:

  • Before: authorize redirects back with error=invalid_scope.
  • After: authorize shows the consent screen; code exchange returns an access token; user ID, email and name resolve; token refresh works.

@luxor-code-review

luxor-code-review Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


This PR repairs the Box OAuth2 provider, which previously sent malformed scope parameters and hit a non-existent user-info path. Scopes in the authorize URL are now space-separated per the Box spec and omitted entirely when none are requested, letting Box fall back to the scopes configured on the app. The hardcoded manage_app_users default scope and the redundant scope field in the token-exchange request were removed, and the user-info call now targets users/me instead of me.

Files Change
src/Appwrite/Auth/OAuth2/Box.php Box OAuth2 flow corrected: optional space-separated scopes, app-scope fallback, cleaner token exchange, and fixed users/me endpoint.

Reviewed commit: 85b0300

@appwrite

appwrite Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The new tests exercise the previously uncovered scope behavior, and the current changes show no remaining correctness issues.

The Box OAuth2 adapter now reads the current-user profile from /2.0/users/me and no longer requests the JWT-only manage_app_users scope by default. Explicit scopes are space-delimited on the authorization URL, token requests omit the scope parameter, and unit tests cover the scope behavior, token flows, and profile mapping.

Latest changes: The newest commits leave Box's default scopes empty, add explicitly configured scopes to the authorization URL with a space delimiter, omit scope from token requests, and add adapter regression tests.

Verdict New comments Fixed Still open
✅ Approved 0 1 0
📂 Walkthrough · 2
File Change
src/Appwrite/Auth/OAuth2/Box.php Omits the default scope, formats configured scopes for Box's authorization endpoint, and removes scope from token requests; the profile endpoint uses /2.0/users/me.
tests/unit/Auth/OAuth2/BoxTest.php Adds regression coverage for default and custom scopes, token exchange and refresh, and profile lookup.
✅ Fixed since the last review · 1
  • Add regression coverage for Box scopes · src/Appwrite/Auth/OAuth2/Box.php:58

Reviewed the commits since 91ea161 · Details · Comment @appwrite review to re-run, or mention @appwrite with a question.

@appwrite appwrite Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · Looks good to merge. Summary

Comment thread src/Appwrite/Auth/OAuth2/Box.php Resolved
HarshMN2345 and others added 2 commits November 9, 2026 14:12
fix(oauth): remove JWT-only manage_app_users scope and space-delimit Box scopes
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

6 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (3)
  • php.appwrite.secret-compare-timing (1)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@appwrite appwrite Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@HarshMN2345
HarshMN2345 merged commit 2b6263e into main Nov 9, 2026
27 of 28 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix-box-oauth-scope (after).

Metric Before After Change
🚀 Requests/sec 200.35 209.37 ⚪ +4.5%
⏱️ Latency P50 86.47 ms 82.51 ms ⚪ -4.6%
⏱️ Latency P95 201.73 ms 192.31 ms ⚪ -4.7%
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 82.51 192.31 13,110 209.37 -9.42
Account 155.43 297.86 690 11.43 +19.37
TablesDB 78.71 144.11 7,130 116.41 -24.32
Storage 77.86 176.43 3,450 58.14 -7.8
Functions 116.36 231.98 1,840 31.68 +17.11

Top API waits (after)

API request Max wait (ms)
account.name.update 460.09
account.prefs.update 441.96
functions.variables.update 423.63
functions.create 377.99
tablesdb.rows.delete 351.18

adityaoberai added a commit that referenced this pull request Nov 9, 2026
Stripe, Autodesk and Box sign-in, and the Pinecone, LangChain RAG,
Replicate and Redis Cloud templates were held back from the catalog because
they didn't work as released. Their fixes are merged (#15414, #15416,
#15417, #15421 and appwrite/templates#498), so add their pages:

- Autodesk is new. The others come from the held-back drafts, without the
  workarounds for the template variable names and the hardcoded Redis port.
- The template pages say what Any execute access exposes and how to narrow
  it, like the other template pages.
- The pages list Cloud only, because no self-hosted release includes the
  fixes yet.

Each page gets a cover in the catalog style. Etsy sign-in and the GitHub
issue bot template still don't work, so they stay out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

🐛 Bug Report: Box OAuth2 adapter always requests the JWT-only manage_app_users scope

2 participants