Skip to content

feat(permissions): extend hook to detect missing scopes to return those scopes for upgrade, update credential selector subblock - #1869

Merged
waleedlatif1 merged 1 commit into
stagingfrom
feat/additional-permissions
Nov 10, 2025
Merged

feat(permissions): extend hook to detect missing scopes to return those scopes for upgrade, update credential selector subblock#1869
waleedlatif1 merged 1 commit into
stagingfrom
feat/additional-permissions

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • extend hook to detect missing scopes to return those scopes for upgrade
  • update credential selector subblock

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercelBot commented Nov 10, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentPreviewCommentsUpdated (UTC)
docsSkippedSkippedNov 10, 2025 7:22pm

…se scopes for upgrade, update credential selector subblock
@waleedlatif1
waleedlatif1force-pushed the feat/additional-permissions branch from 6e128a2 to 348d224CompareNovember 10, 2025 19:22
@waleedlatif1
waleedlatif1 marked this pull request as ready for review November 10, 2025 19:26
@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

Extended OAuth scope management to detect and prompt users to upgrade credentials when additional permissions are required, with UI improvements to clearly communicate missing scopes.

Key Changes

  • Added getMissingRequiredScopes() and needsUpgradeForRequiredScopes() helper functions to detect when a credential lacks required OAuth scopes
  • Enhanced credential selector components to display an amber warning banner when additional permissions are needed, with an "Update access" button
  • Updated OAuthRequiredModal to highlight newly required scopes with a "New" badge
  • Improved scope parsing to handle both space and comma-separated scope strings in API response
  • Changed credentialId validation from UUID-only to generic string (matching database schema where account.id is text type)
  • Added scopeHints to OAuth provider configs for better service detection from scope lists
  • Removed unnecessary gmail.readonly scope from Gmail block configurations (keeping only required scopes per operation)
  • Expanded scope lists for Jira, Slack, and Reddit to match their current API requirements

Implementation Quality

The implementation is well-structured with proper separation of concerns. The new utility functions are reusable and the UI feedback is clear and user-friendly.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are well-implemented, follow existing patterns, and improve the OAuth credential management UX. The credentialId validation change correctly aligns with the database schema. Scope detection logic is sound and the UI improvements provide clear user feedback.
  • No files require special attention

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/hooks/use-oauth-scope-status.ts5/5Added utility functions to compute missing required scopes and determine if a credential needs an upgrade
apps/sim/lib/oauth/oauth.ts4/5Enhanced scope management with scopeHints for service detection, improved getServiceIdFromScopes logic, and added extensive scopes for Jira, Slack, and Reddit
apps/sim/app/api/auth/oauth/credentials/route.ts5/5Changed credentialId validation from UUID to generic string (min 1, max 255) and improved scope parsing to handle comma-separated values
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/components/sub-block/components/credential-selector/credential-selector.tsx5/5Integrated missing scope detection to show warning banner when additional permissions required, passes canonical scopes and newScopes to OAuth modal

Sequence Diagram

sequenceDiagram
participant User
participant CredentialSelector
participant Hook as getMissingRequiredScopes
participant CredentialsAPI
participant Modal as OAuthRequiredModal
participant OAuthProvider
User->>CredentialSelector: Select credential
CredentialSelector->>Hook: Check missing scopes
Hook-->>CredentialSelector: Return missing scopes list
alt Missing scopes found
CredentialSelector->>CredentialSelector: Show permissions banner
User->>CredentialSelector: Click Update button
CredentialSelector->>Modal: Open modal
Modal->>Modal: Display scope list
User->>Modal: Click Connect
Modal->>OAuthProvider: Initiate flow
OAuthProvider-->>CredentialsAPI: Send authorization
CredentialsAPI->>CredentialsAPI: Parse and evaluate scopes
CredentialsAPI-->>CredentialSelector: Updated credential data
CredentialSelector->>Hook: Recheck scopes
Hook-->>CredentialSelector: No missing scopes
CredentialSelector->>CredentialSelector: Hide banner
end
Loading

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

8 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
waleedlatif1 merged commit b03f970 into stagingNov 10, 2025
9 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/additional-permissions branch November 10, 2025 19:40
waleedlatif1 added a commit that referenced this pull request Nov 12, 2025
…se scopes for upgrade, update credential selector subblock (#1869)
waleedlatif1 added a commit that referenced this pull request Nov 12, 2025
…se scopes for upgrade, update credential selector subblock (#1869)
@waleedlatif1waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
Sign up for freeto 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

@waleedlatif1