Skip to content

Commit 8166d56

Browse files
committed
chore(credentials): drop redundant redirect options and correct SailPoint and HubSpot docs
fetchProvider already refuses redirects by default. Zendesk's hidden token param uses savedCredentialTokenParam, the SailPoint minter takes its token URL from resolveSailPointHosts, and the SailPoint host and HubSpot fallback TSDoc now match the code.
1 parent 110f604 commit 8166d56

10 files changed

Lines changed: 18 additions & 21 deletions

File tree

‎apps/sim/lib/credentials/client-credential-accounts/descriptors.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@ export function resolveZohoDeskDataCenter(rawDataCenter?: string): {
413413

414414
/**
415415
* A SailPoint Identity Security Cloud API host: one tenant label under `api.identitynow.com`, or
416-
* under `api.identitynowgov.com` for government tenants (the same hosts the legacy block accepts).
416+
* under `api.identitynowgov.com` for government tenants. Stricter than the legacy block's inline
417+
* tenant, which also admits a dotted prefix under either domain.
417418
*/
418419
const SAILPOINT_API_HOST_REGEX =
419420
/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.api\.identitynow(?:gov)?\.com$/

‎apps/sim/lib/credentials/client-credential-accounts/minters/datadog.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ export async function mintDatadogServiceAccountToken(
6767
datadogApiUrl(site, '/api/v1/validate'),
6868
{
6969
method: 'GET',
70-
redirect: 'error',
7170
signal: options?.signal,
7271
headers: { Accept: 'application/json', 'DD-API-KEY': apiKey },
7372
},

‎apps/sim/lib/credentials/client-credential-accounts/minters/sailpoint.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ import {
1111
requireClientSecret,
1212
TokenServiceAccountValidationError,
1313
} from '@/lib/credentials/token-service-accounts/errors'
14-
import { requestSailPointToken, SailPointAuthError } from '@/lib/internal/sailpoint/client'
14+
import {
15+
requestSailPointToken,
16+
resolveSailPointHosts,
17+
SailPointAuthError,
18+
} from '@/lib/internal/sailpoint/client'
1519

1620
const STEP = 'sailpoint_token_mint'
1721
/** Bounds the whole exchange, including its 429 backoff retries. */
@@ -45,11 +49,12 @@ export async function mintSailPointServiceAccountToken(
4549
})
4650
}
4751

52+
const { tokenUrl } = resolveSailPointHosts(host)
4853
const timeout = AbortSignal.timeout(TOKEN_EXCHANGE_TIMEOUT_MS)
4954
let minted: { token: string; expiresInSeconds: number }
5055
try {
5156
minted = await requestSailPointToken(
52-
`https://${host}/oauth/token`,
57+
tokenUrl,
5358
fields.clientId,
5459
clientSecret,
5560
options?.signal ? AbortSignal.any([options.signal, timeout]) : timeout

‎apps/sim/lib/credentials/client-credential-accounts/minters/zendesk.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ async function exchangeClientCredentials(
9494
scope,
9595
expires_in: REQUESTED_TOKEN_LIFETIME_SECONDS,
9696
}),
97-
redirect: 'error',
9897
cache: 'no-store',
9998
signal,
10099
},
@@ -135,7 +134,6 @@ async function verifyStaffUser(
135134
{
136135
method: 'GET',
137136
headers: { Accept: 'application/json', Authorization: authorization },
138-
redirect: 'error',
139137
cache: 'no-store',
140138
signal,
141139
},

‎apps/sim/lib/credentials/client-credentials-grant.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ export async function exchangeClientCredentialsGrant(
7070
client_secret: request.clientSecret,
7171
...extraFields,
7272
}).toString(),
73-
redirect: 'error',
7473
cache: 'no-store',
7574
signal,
7675
},

‎apps/sim/lib/credentials/token-service-accounts/validators/hubspot.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,12 @@ const HUBSPOT_KEY_PREFIX = /^pat-/
101101
* tokens, so one code path covers both regions.
102102
*
103103
* That endpoint is documented only for private app tokens, and live probing
104-
* shows it returns a bare 404 (HTML) for a token it does not recognize. So a
105-
* 400, 403 or 404, a 401 for a `pat-` key (which may be a service key), or a
106-
* 200 without a portal falls back to the Account Information API, and a key
107-
* that route refuses is settled by a contacts read, the route HubSpot documents
108-
* for service keys. A token-info 401 for any other token is a rejection.
104+
* shows it returns a bare 404 (HTML) for a token it does not recognize. So any
105+
* non-transient 4xx other than 401 (408 and 429 are transient), a 401 for a
106+
* `pat-` key (which may be a service key), or a 200 without a portal falls back
107+
* to the Account Information API, and a key that route refuses is settled by a
108+
* contacts read, the route HubSpot documents for service keys. A token-info 401
109+
* for any other token is a rejection.
109110
*
110111
* The display name is `HubSpot portal {hubId}` when the portal is known — the
111112
* account-info `uiDomain` is the shared regional host (e.g. `app.hubspot.com`),

‎apps/sim/lib/credentials/token-service-accounts/validators/linear.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export async function validateLinearServiceAccount(
8282
'Content-Type': 'application/json',
8383
},
8484
body: JSON.stringify({ query: VIEWER_QUERY }),
85-
redirect: 'error',
8685
},
8786
'viewer'
8887
)

‎apps/sim/lib/credentials/token-service-accounts/validators/shopify.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ export async function validateShopifyServiceAccount(
9595
'X-Shopify-Access-Token': fields.apiToken,
9696
},
9797
body: JSON.stringify({ query: SHOP_QUERY }),
98-
redirect: 'error',
9998
},
10099
'shop_query',
101100
{ dnsFailureCode: 'site_not_found', dnsFailureReason: 'store domain does not resolve' }

‎apps/sim/tools/generated/tool-metadata.ts‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎apps/sim/tools/zendesk/types.ts‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createLogger } from '@sim/logger'
2+
import { savedCredentialTokenParam } from '@/tools/shared/saved-credentials'
23
import type { OutputProperty, ToolConfig } from '@/tools/types'
34

45
const logger = createLogger('Zendesk')
@@ -57,12 +58,7 @@ export function zendeskAuthorization(params: ZendeskAuthParams): string {
5758

5859
/** Hidden params a saved Zendesk credential fills; every Zendesk tool declares them. */
5960
export const ZENDESK_CREDENTIAL_PARAMS = {
60-
accessToken: {
61-
type: 'string',
62-
required: false,
63-
visibility: 'hidden',
64-
description: 'Token injected by the executor from the selected Zendesk credential',
65-
},
61+
accessToken: savedCredentialTokenParam('Zendesk'),
6662
authStyle: {
6763
type: 'string',
6864
required: false,

0 commit comments

Comments
 (0)