Skip to content

Conversation

@waleedlatif1
Copy link
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
Copy link

vercel bot commented Nov 10, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Nov 10, 2025 7:22pm

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

@greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 10, 2025

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

Filename Score Overview
apps/sim/hooks/use-oauth-scope-status.ts 5/5 Added utility functions to compute missing required scopes and determine if a credential needs an upgrade
apps/sim/lib/oauth/oauth.ts 4/5 Enhanced 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.ts 5/5 Changed 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.tsx 5/5 Integrated 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

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

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 staging Nov 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)
@waleedlatif1 waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
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.

2 participants