MCPcopy Index your code
hub / github.com/simstudioai/sim / agiloftLoginPinned

Function agiloftLoginPinned

apps/sim/tools/agiloft/utils.server.ts:38–63  ·  view source on GitHub ↗
(
  params: AgiloftBaseParams,
  resolvedIP: string
)

Source from the content-addressed store, hash-verified

36 * the actual TCP connection.
37 */
38export async function agiloftLoginPinned(
39 params: AgiloftBaseParams,
40 resolvedIP: string
41): Promise<string> {
42 const base = params.instanceUrl.replace(/\/$/, '')
43 const kb = encodeURIComponent(params.knowledgeBase)
44 const login = encodeURIComponent(params.login)
45 const password = encodeURIComponent(params.password)
46
47 const url = `${base}/ewws/EWLogin?$KB=${kb}&$login=${login}&$password=${password}`
48 const response = await secureFetchWithPinnedIP(url, resolvedIP, { method: 'POST' })
49
50 if (!response.ok) {
51 const errorText = await response.text()
52 throw new Error(`Agiloft login failed: ${response.status} - ${errorText}`)
53 }
54
55 const data = (await response.json()) as { access_token?: string }
56 const token = data.access_token
57
58 if (!token) {
59 throw new Error('Agiloft login did not return an access token')
60 }
61
62 return token
63}
64
65/**
66 * DNS-pinned variant of agiloftLogout. Best-effort — failures are logged but

Callers 3

route.tsFile · 0.90
route.tsFile · 0.90
executeAgiloftRequestFunction · 0.85

Calls 3

secureFetchWithPinnedIPFunction · 0.90
textMethod · 0.80
replaceMethod · 0.65

Tested by

no test coverage detected