diff --git a/components/ui/oauth-required-modal.tsx b/components/ui/oauth-required-modal.tsx index fd09b4b57f..71a1da616c 100644 --- a/components/ui/oauth-required-modal.tsx +++ b/components/ui/oauth-required-modal.tsx @@ -1,5 +1,6 @@ 'use client' +import { Check } from 'lucide-react' import { GithubIcon, GoogleIcon, xIcon as XIcon } from '@/components/icons' import { Button } from '@/components/ui/button' import { @@ -36,6 +37,27 @@ const PROVIDER_ICONS: Record = { + 'https://www.googleapis.com/auth/gmail.send': 'Send emails on your behalf', + 'https://www.googleapis.com/auth/gmail.readonly': 'View and read your email messages', + 'https://www.googleapis.com/auth/drive': 'View and manage your Google Drive files', + 'https://www.googleapis.com/auth/calendar': 'View and manage your calendar', + 'https://www.googleapis.com/auth/userinfo.email': 'View your email address', + 'https://www.googleapis.com/auth/userinfo.profile': 'View your basic profile info', + repo: 'Access your repositories', + workflow: 'Manage repository workflows', + 'user:email': 'Access your email address', + 'tweet.read': 'Read your tweets', + 'tweet.write': 'Create tweets on your behalf', + 'users.read': 'Read your profile information', +} + +// Convert OAuth scope to user-friendly description +function getScopeDescription(scope: string): string { + return SCOPE_DESCRIPTIONS[scope] || scope +} + export function OAuthRequiredModal({ isOpen, onClose, @@ -47,6 +69,11 @@ export function OAuthRequiredModal({ const providerName = PROVIDER_NAMES[provider] || provider const ProviderIcon = PROVIDER_ICONS[provider] + // Filter out userinfo scopes as they're not relevant to show to users + const displayScopes = requiredScopes.filter( + (scope) => !scope.includes('userinfo.email') && !scope.includes('userinfo.profile') + ) + const handleRedirectToSettings = () => { try { // Determine the appropriate providerId and serviceId based on the provider and required scopes @@ -149,15 +176,22 @@ export function OAuthRequiredModal({ - {requiredScopes.length > 0 && ( -
- Permissions requested -
+ )}