Basic Authentication

Rate this page:

Basic Authentication is a method for an HTTP user agent (e.g., a web browser) to provide a username and password when making a request.

When employing Basic Authentication, users include an encoded string in the Authorization header of each request they make. The string is used by the request’s recipient to verify users’ identity and rights to access a resource.

The Authorization header follows this format:

Authorization: Basic <credentials>

We then construct the credentials like this:

  1. The user’s username and password are combined with a colon.
  2. The resulting string is base64 encoded.

So if your username and password are twilio and ahoy!, the combination is twilio:ahoy!, and when base64 encoded, this becomes dHdpbGlvOmFob3kh. So requests made by this user would be sent with the following header:

Authorization: Basic dHdpbGlvOmFob3kh

When your server or Twilio Function receives this request, it can access the Authorization header, decode the credentials, and look up the user to determine if they should be allowed access to the requested resource.

Rate this page:

Thank you for your feedback!

We are always striving to improve our documentation quality, and your feedback is valuable to us. Please select the reason(s) for your feedback or provide additional information about how we can improve:

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

Refer us and get $10 in 3 simple steps!

Step 1

Get link

Get a free personal referral link here

Step 2

Give $10

Your user signs up and upgrade using link

Step 3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more