For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • Configuration
        • AuthHandler
          • expressMiddleware
          • getAuthInfo
          • hasApiKeyAuth
          • hasBasicAuth
          • hasBearerAuth
          • middleware
          • validate
          • verifyApiKey
          • verifyBasicAuth
          • verifyBearerToken
        • ConfigLoader
        • Environment Variables
        • Logging
        • PromptManager
        • SchemaUtils
        • ServerlessAdapter
        • SessionManager
        • SslConfig
      • ContextBuilder
      • DataMap
      • FunctionResult
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • ChatResource
      • Compat
      • Datasphere
      • Fabric
      • ImportedNumbersResource
      • Logs
      • LookupResource
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSubResource
      • Queues
      • Recordings
      • Registry
      • RestClient
      • RestError
      • Short Codes
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Parameters
  • Returns
  • Example
AgentsConfigurationAuthHandler

validate

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

verifyApiKey

Next
Built with

Validate request headers against configured auth methods (Bearer, API Key, Basic, Custom) in order. Returns true if any configured method accepts the request, or if no methods are configured and allowUnauthenticated is not false.

Parameters

headers
Record<string, string>Required

The request headers as a string-keyed record. The method checks both lowercase and title-case header names (e.g., authorization and Authorization).

Returns

Promise<boolean> — true if the request is authorized.

Example

1import { AuthHandler } from '@signalwire/sdk';
2
3const auth = new AuthHandler({
4 bearerToken: 'my-secret-token',
5});
6
7// Validate headers from an incoming request
8const isValid = await auth.validate({
9 authorization: 'Bearer my-secret-token',
10});
11console.log('Authorized:', isValid); // true