fix(oauth): fall back to configured scopes when DB scope is empty#3678
fix(oauth): fall back to configured scopes when DB scope is empty#3678icecrasher321 merged 1 commit intostagingfrom
Conversation
Providers like Box don't return a scope field in their token response, leaving the account.scope column empty. The credentials API now falls back to the provider's configured scopes when the stored scope is empty, preventing false "Additional permissions required" banners. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR SummaryLow Risk Overview When no stored scope is present, the API now falls back to Written by Cursor Bugbot for commit c6db5c5. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR fixes a false "Additional permissions required" banner caused by OAuth providers (e.g. Box) that don't include a Key points:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant CredentialsAPI as GET /api/auth/oauth/credentials
participant DB as Database (account table)
participant OAuthUtils as getCanonicalScopesForProvider
Client->>CredentialsAPI: GET ?provider=box&workspaceId=...
CredentialsAPI->>DB: SELECT account.scope FROM credential JOIN account
DB-->>CredentialsAPI: scope = null (Box never returns scope in token response)
CredentialsAPI->>CredentialsAPI: toCredentialResponse(id, name, "box", updatedAt, null)
Note over CredentialsAPI: storedScope = null?.trim() = undefined (falsy)
CredentialsAPI->>OAuthUtils: getCanonicalScopesForProvider("box")
OAuthUtils-->>CredentialsAPI: ["root_readwrite", "sign_requests.readwrite", ...]
CredentialsAPI-->>Client: { credentials: [{ scopes: ["root_readwrite", ...] }] }
Note over Client: No "Additional permissions required" banner shown
Last reviewed commit: "fix(oauth): fall bac..." |
Summary
scopefield in its token response, theaccount.scopeDB column stays emptygetCanonicalScopesForProvider()instead of returning an empty arrayTest plan