Skip to content

Commit 636bd74

Browse files
authored
fix(integrations): resolve OAuth connect UI by service id instead of display name (#5001)
* fix(integrations): resolve OAuth connect UI by service id instead of display name * test(integrations): pin OAuth service resolution for all catalog integrations; fix credential branding reverse lookup * fix(docs-gen): blank string literals and comments before brace scanning in extractOAuthServiceId
1 parent 2c4d9e9 commit 636bd74

9 files changed

Lines changed: 314 additions & 29 deletions

File tree

apps/sim/app/workspace/[workspaceId]/integrations/[block]/integration-block-detail.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ export function IntegrationBlockDetail({ integration, workspaceId }: Integration
6666
(c) =>
6767
(c.type === 'oauth' || c.type === 'service_account') &&
6868
c.providerId &&
69-
getServiceConfigByProviderId(c.providerId)?.name.toLowerCase() ===
70-
oauthService.serviceName.toLowerCase()
69+
getServiceConfigByProviderId(c.providerId)?.providerId === oauthService.providerId
7170
)
7271
}, [credentials, oauthService])
7372
const [serviceAccountOpen, setServiceAccountOpen] = useState(false)

apps/sim/app/workspace/[workspaceId]/integrations/connected/[credentialId]/connected-credential-detail.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '@/components/emcn'
1616
import { ArrowLeft } from '@/components/emcn/icons'
1717
import { writeOAuthReturnContext } from '@/lib/credentials/client-state'
18-
import { INTEGRATIONS } from '@/lib/integrations'
18+
import { INTEGRATIONS, resolveOAuthServiceForIntegration } from '@/lib/integrations'
1919
import { getServiceConfigByProviderId } from '@/lib/oauth'
2020
import {
2121
AddPeopleModal,
@@ -98,15 +98,20 @@ export function ConnectedCredentialDetail({
9898
}, [credential])
9999

100100
/**
101-
* Resolve the integration block type from the OAuth service name so the
102-
* header tile can render with the same brand background used by the rows on
103-
* the integrations list page.
101+
* Resolve the integration block type from the credential's OAuth service so
102+
* the header tile can render with the same brand background used by the rows
103+
* on the integrations list page. Several integrations can share one service
104+
* (e.g. Jira and Jira Service Management); the one named after the service
105+
* is preferred since it is the service's canonical integration.
104106
*/
105107
const integrationBlockType = useMemo(() => {
106-
const name = serviceConfig?.name.toLowerCase()
107-
if (!name) return ''
108-
const match = INTEGRATIONS.find((i) => i.name.toLowerCase() === name)
109-
return match?.type ?? ''
108+
if (!serviceConfig) return ''
109+
const candidates = INTEGRATIONS.filter(
110+
(i) => resolveOAuthServiceForIntegration(i)?.providerId === serviceConfig.providerId
111+
)
112+
const serviceName = serviceConfig.name.toLowerCase()
113+
const canonical = candidates.find((i) => i.name.toLowerCase() === serviceName)
114+
return (canonical ?? candidates[0])?.type ?? ''
110115
}, [serviceConfig])
111116

112117
const handleReconnectOAuth = async () => {

0 commit comments

Comments
 (0)