Skip to contentSkip to navigationSkip to topbar
Page tools
Useful for sharing or LLM
Accelerate development with AI

On this page
Looking for more inspiration?Visit the

Authentication anti-patterns


Poor authentication practices lead to credential compromise. Even with strong authentication mechanisms available, mistakes in how you store, transmit, or manage credentials undermine all security protections.

The following patterns cover common practices that significantly increase risk. These patterns appear frequently in compromised integrations. Avoid these patterns.


Practices to avoid

practices-to-avoid page anchor

Poor authentication practices make credential compromise easy for attackers and incidents expensive to remediate. The following practices increase risk:

Keep credentials out of code or repositories

keep-credentials-out-of-code-or-repositories page anchor
  • Never embed Auth Tokens, Main API Keys, or Restricted API Keys in browser code or mobile apps.
  • Never hardcode credentials in source files including temporary commits you plan to remove.
  • Never hardcode credentials in infrastructure templates, configuration files, or Docker images.
  • Never commit credentials to version control repositories or CI/CD systems.

Secure credentials storage

secure-credentials-storage page anchor
  • Never store credentials in plain-text files on disk.
  • Never store credentials in unencrypted local storage like browsers or mobile devices.
  • Never log full authorization headers, request bodies containing secrets, or environment variables.
  • Never transmit credentials through email, chat systems, screenshots, or issue trackers.

Don't reuse or overshare credentials

dont-reuse-or-overshare-credentials page anchor
  • Never share credentials with people, vendors, or support channels. Grant controlled access.
  • Never reuse one credential across multiple unrelated apps or environments.
  • Never reuse credentials after team member changes, vendor relationships end, or deployments change.
  • Never grant access to production credentials to all users. Implement role-based access control.

Don't substitute authentication with network controls

dont-substitute-authentication-with-network-controls page anchor
  • Never treat a private network connection (VPN, private subnet, firewalls) as a replacement for authentication.
  • Never assume internal only means you don't need to protect credentials.
  • Never substitute network security for app security.

Keep authentication mechanisms current

keep-authentication-mechanisms-current page anchor
  • Never ignore security advisories for Twilio SDKs, dependencies, frameworks, or infrastructure.
  • Never delay applying security patches to systems that can access Twilio APIs.
  • Never use deprecated or end-of-life versions of authentication libraries.

Why these mistakes happen

why-these-mistakes-happen page anchor

Anti-patterns simplify initial development through the following poor practices:

  • Embedding credentials speeds prototyping.
  • Hardcoding involves less work than integrating a secrets manager.
  • Sharing credentials avoids waiting for access approvals.
  • Skipping secrets management feels like progress until an incident occurs.

The development time saved gets lost in incident response, emergency credential rotation, and security audits.


Common consequences of anti-patterns

common-consequences-of-anti-patterns page anchor

These mistakes lead to the following consequences:


Implement secure credential practices: