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

Function verifyAuth

apps/sim/lib/webhooks/providers/servicenow.ts:19–35  ·  view source on GitHub ↗
({ request, requestId, providerConfig }: AuthContext)

Source from the content-addressed store, hash-verified

17
18export const servicenowHandler: WebhookProviderHandler = {
19 verifyAuth({ request, requestId, providerConfig }: AuthContext): NextResponse | null {
20 const secret = providerConfig.webhookSecret as string | undefined
21 if (!secret?.trim()) {
22 logger.warn(`[${requestId}] ServiceNow webhook missing webhookSecret — rejecting`)
23 return new NextResponse('Unauthorized - Webhook secret not configured', { status: 401 })
24 }
25
26 if (
27 !verifyTokenAuth(request, secret.trim(), 'x-sim-webhook-secret') &&
28 !verifyTokenAuth(request, secret.trim())
29 ) {
30 logger.warn(`[${requestId}] ServiceNow webhook secret verification failed`)
31 return new NextResponse('Unauthorized - Invalid webhook secret', { status: 401 })
32 }
33
34 return null
35 },
36
37 async matchEvent({ webhook, workflow, body, requestId, providerConfig }: EventMatchContext) {
38 const triggerId = providerConfig.triggerId as string | undefined

Callers

nothing calls this directly

Calls 2

verifyTokenAuthFunction · 0.90
warnMethod · 0.65

Tested by

no test coverage detected