Skip to content

Commit 0070c03

Browse files
waleedlatif1claude
andcommitted
fix(higgsfield): verify keys against the documented request status route
The Soul ID list route used for key checks is undocumented. The status route is documented and answers 404 for an accepted key and 401 for a rejected one, so it is a stable probe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f0053dd commit 0070c03

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • apps/sim/lib/credentials/token-service-accounts/validators

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import type {
99
} from '@/lib/credentials/token-service-accounts/server'
1010

1111
/**
12-
* Higgsfield has no identity endpoint, so the cheapest authenticated read — one page of the
13-
* account's Soul ID characters — proves the key ID and secret are accepted.
12+
* Higgsfield has no identity endpoint, so the key is checked against the documented request
13+
* status route with an ID no account owns: an accepted key gets 404, a rejected one gets 401.
1414
*/
1515
const HIGGSFIELD_VERIFY_URL =
16-
'https://api.higgsfield.ai/v1/custom-references/list?page=1&page_size=1'
16+
'https://api.higgsfield.ai/requests/00000000-0000-4000-8000-000000000000/status'
1717
const KEY_PATTERN = /^([^:\s]+):[^:\s]+$/
1818

1919
/** Verifies a Higgsfield `KEY_ID:KEY_SECRET` pair. */
@@ -34,9 +34,9 @@ export async function validateHiggsfieldServiceAccount(
3434
headers: { Authorization: `Key ${fields.apiToken.trim()}`, Accept: 'application/json' },
3535
redirect: 'error',
3636
},
37-
'list_custom_references'
37+
'get_request_status'
3838
)
39-
await throwForProviderResponse(response, 'list_custom_references')
39+
if (response.status !== 404) await throwForProviderResponse(response, 'get_request_status')
4040
await response.body?.cancel().catch(() => undefined)
4141

4242
return {

0 commit comments

Comments
 (0)