Repository navigation
fix(oauth): remove JWT-only manage_app_users scope and space-delimit Box scopes - #15420
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Hi @eldadfux and @HarshMN2345, please review this PR when you have a moment. It resolves #15371 by removing the JWT-only manage_app_users scope from the default scopes, space-delimiting custom scopes on the Box authorize URL when specified, updating the user profile endpoint to /users/me, and cleaning up token exchange parameters. All unit tests (including the new suite in ests/unit/Auth/OAuth2/BoxTest.php) and Pint lint checks pass cleanly. |
🟢 Tier S · Ready to mergeThe Box OAuth2 adapter now defaults to no requested scopes, formats any configured scopes as a space-delimited authorize parameter, and omits scope from token exchange requests. It also queries the Box
Note @hardikkaurani does not have write access to this repository, so Hansi does not approve automatically. A maintainer can review and approve. 📂 Walkthrough · 2
Merged |
|
Thanks @HarshMN2345 |
|
Thanks for your contribution! Merged into appwrite/appwrite#15421 · fix(oauth): make Box sign-in…, which also fixes the Box profile request, and thats going to main. |
What does this PR do?
Fixes #15371.
manage_app_usersas applying only to server-side authenticated (JWT) applications. Standard user authentication OAuth 2.0 apps do not use this scope and will fail authorization. The default scopes are now empty ([]), allowing Box to fall back to the scopes configured on the app in the Box Developer Console./oauth2/token) does not takescopeforauthorization_codegrant; removed extraneous comma-separatedscopefrom token request payload.getUser()to Box's official/users/meendpoint (https://api.box.com/2.0/users/me).Test Plan
tests/unit/Auth/OAuth2/BoxTest.php:testDefaultScopesAreEmptyAndLoginURLOmitsScope: verifies default scopes are empty and noscopeparam is attached to the authorize URL.testLoginURLWithCustomScopesUsesSpaceDelimiter: verifies custom scopes are space-delimited.testTokenExchangeRequestAndResponse: verifies token exchange payload format and headers.testRefreshTokenRequest: verifies token refresh request.testGetUserProfileQueriesUsersMeEndpoint: verifies user profile request to/users/meand attribute parsing.tests/unit/Auth/OAuth2/BoxTest.php: 5 tests, 33 assertions passed.tests/unit/Auth/OAuth2/: 99 tests, 434 assertions passed.vendor/bin/pint --test --config pint.json src/Appwrite/Auth/OAuth2/Box.php tests/unit/Auth/OAuth2/BoxTest.php: PASS (2 files).Related PRs and Issues
Checklist