RealComposer

Twilio Safe & Unsafe Practices

Direct Answer

Twilio Account SIDs with Auth Tokens or API key secrets are server-only. Client SDKs should receive short-lived Access Tokens minted by your server. Validate X-Twilio-Signature on webhooks and rate limit any endpoint that sends SMS or places calls.

Credentials & Where They Belong

Server only
Account SID and Auth Token

Primary account credentials. Prefer API keys for integrations.

Server only
API key SID and secret

Revocable credentials for server integrations.

Client safe
Access Token (JWT)

Short-lived, grant-scoped token minted for Voice, Video, or Conversations SDKs.

Safe Practices

  • Validate X-Twilio-Signature

    Reject webhook requests whose signature does not match your auth token.

  • Restrict geo permissions and rate limit sends

    Disable countries you do not serve and cap messages per user to prevent SMS pumping.

  • Use Verify for one-time codes

    Twilio Verify includes fraud guards that hand-rolled OTP endpoints lack.

Unsafe Practices

  • Shipping the Auth Token in an app

    Attackers can send messages and place calls billed to your account.

  • Exposing an open send-SMS endpoint

    Unauthenticated endpoints are abused for toll fraud to premium numbers.

The RealComposer Pattern

Store Twilio credentials in the vault and expose a client-token-protected pipeline with fixed message templates so callers cannot send arbitrary content.

START BUILDING FREE

Frequently Asked Questions

Q:How do mobile apps use Twilio safely?

Your server mints a short-lived Access Token for the SDK. The Auth Token never leaves the server.

Related Concepts