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
      • ContextBuilder
      • DataMap
      • FunctionResult
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
        • addSection
        • addVerb
        • addVerbToSection
        • asRouter
        • extractSipUsername
        • getApp
        • getBasicAuthCredentials
        • getBuilder
        • getDocument
        • manualSetProxyUrl
        • onRequest
        • registerRoutingCallback
        • registerVerbHandler
        • renderDocument
        • renderSwml
        • resetDocument
        • run
        • serve
        • setOnRequestCallback
        • stop
    • 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
AgentsSWMLService

getBasicAuthCredentials

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

getBuilder

Next
Built with

Retrieve the current HTTP Basic Auth credentials used by this service. Every SWMLService instance has auth credentials — either explicitly provided in the constructor, read from environment variables, or auto-generated at startup.

Parameters

includeSource
booleanDefaults to false

When true, returns a 3-tuple that includes the credential source as the third element. The source is one of:

  • "provided" — credentials were passed through constructor options
  • "environment" — credentials came from SWML_BASIC_AUTH_USER and SWML_BASIC_AUTH_PASSWORD environment variables
  • "auto-generated" — credentials were randomly generated at startup

Returns

[string, string] — A [username, password] tuple when includeSource is false or omitted.

[string, string, 'provided' | 'environment' | 'auto-generated'] — A [username, password, source] tuple when includeSource is true.

Example

1import { SWMLService } from '@signalwire/sdk';
2
3const service = new SWMLService({ name: 'my-service' });
4
5// Get credentials
6const [username, password] = service.getBasicAuthCredentials();
7console.log(`Auth: ${username}:${password}`);
8
9// Get credentials with source information
10const [user, pass, source] = service.getBasicAuthCredentials(true);
11console.log(`Auth source: ${source}`); // "provided", "environment", or "auto-generated"