Quick answer
Basic authentication (HTTP Basic) is the simplest HTTP login scheme: the client sends Authorization: Basic followed by the Base64 of username:password with every request. Base64 is encoding, not encryption, so it is only acceptable over HTTPS and is a poor fit for user-facing sign-in.
Formula: Authorization: Basic base64(username + ":" + password)
What is basic authentication?
Basic authentication is the original HTTP login scheme, defined in RFC 7617. When a server wants proof of identity, it answers 401 Unauthorized with a WWW-Authenticate: Basic realm="..." header. The client then repeats the request with an Authorization header holding the word Basic and the Base64 of username:password. Browsers show a small login box; command-line tools and scripts just add the header.
The verdict in one paragraph: Basic authentication is encoding, not protection. It has no encryption, no expiry, no scope and no logout, so it is acceptable only over HTTPS, only for low-stakes or machine-to-machine access, and not for people signing in to a product. The rest of this page shows why, with a decoded header and the arithmetic of guessing.
How the exchange and the header work
The flow has three moves:
- The client requests a protected URL with no credentials.
- The server replies
401withWWW-Authenticate: Basic realm="Staging". The realm is only a label for the protected area. - The client resends the request with
Authorization: Basic <credentials>, and does so again on every later request to that area, because HTTP itself keeps no session.
The credentials are built in two steps: join the user and password with a colon (username:password), then Base64-encode the whole string. One rule follows from the format: the user name cannot contain a colon, because the first colon in the string is the separator. The password can.
Worked example (sample data): RFC 7617's own pair, user Aladdin and password open sesame.
| Step | Value |
|---|---|
| Join with a colon | Aladdin:open sesame |
| Base64-encode | QWxhZGRpbjpvcGVuIHNlc2FtZQ== |
| Header sent | Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== |
With curl the same thing is curl -u Aladdin:"open sesame" https://example.com/, and curl builds the header for you.
Is Base64 encryption?
No, and this is the most common misunderstanding. Base64 maps every 3 bytes to 4 printable characters. There is no key and no secret, so decoding is one function call. A second sample header, YWxpY2U6czNjcmV0LXBhc3M= (24 characters), decodes to alice:s3cret-pass. Anyone who sees that string in a proxy log, a browser extension, a screenshot or a packet capture has the password.
That is why RFC 7617 requires the connection itself to be protected: the scheme's only secrecy comes from TLS around it. Without HTTPS, every request exposes the password to every network device in between.
Basic vs Digest, Bearer, API key and session cookie
| Scheme | What is sent on each request | Can it expire or be limited? | If it leaks | Typical use |
|---|---|---|---|---|
| Basic (RFC 7617) | The account's username and password | No, unless the password changes | Attacker has the real password, possibly reused elsewhere | Staging locks, simple internal services, some webhooks |
| Digest (RFC 7616) | A hash computed from the password and a server challenge | No | Password is not sent, but old hashing choices are weak | Legacy systems |
| Bearer token (RFC 6750) | A token issued for the purpose | Yes: lifetime, scope, revocation | Attacker has a token that can be revoked, not the password | APIs, OAuth 2.0 access tokens |
| API key | A long random string, usually in a header | By design, if the provider supports rotation and scopes | Revoke and reissue the key | Server-to-server calls |
| Session cookie | An opaque session id set after a login form | Yes: idle and absolute timeouts, logout | Revoke that session | People signing in to a web product |
The rule of thumb: if the thing being sent is the real password, a leak is expensive. If it is a separate credential that can be revoked, a leak is an incident you can close. API keys carry one extra warning: put them in a header, not in the URL, because URLs end up in server logs, browser history and referrer headers.
How risky is guessing, and what does rate limiting change?
Basic authentication has no built-in lockout, so protection depends on whatever sits in front of it. Rate limiting is that layer. The arithmetic below uses sample figures.
| Password space | Guesses to try everything | At 100 requests/s | At 5 requests/minute (rate limited) |
|---|---|---|---|
| 6-digit PIN | 10^6 = 1,000,000 | 10,000 s ≈ 2.8 hours | 200,000 min ≈ 138.9 days |
| 8 lowercase letters | 26^8 = 208,827,064,576 | about 66 years | about 79,500 years |
Two cautions. First, the exhaustive figures are worst cases; on average an attacker succeeds after trying half of the space. Second, attackers rarely try everything: they try lists of leaked and common passwords first, so a short or reused password falls in minutes whatever the space looks like on paper. The lesson is that a long, random, unique password plus a request limit does the work, and the header format adds nothing.
Where Basic credentials leak
- Logs. Servers and proxies that log request headers record the
Authorizationline. Mask it, and treat the log as holding passwords. A username can itself be personal data, so the same care applies. - URLs. Putting credentials in the address (
https://user:pass@host/) puts them in history, bookmarks and referrer data. Use the header instead. - Browser caching and shared devices. Browsers keep Basic credentials for the session and have no real logout; closing every window is the only reset.
- Screenshots and tickets. A pasted
curlcommand or HAR file contains the header. Strip it before sharing. - Reused passwords. The password sent is the real one. If a staging password is also someone's work password, one log line is enough.
Who may see these logs, and how long they are kept, is a data governance decision; settle it before turning on header logging.
Common mistakes
- Treating Base64 as protection ("it looks scrambled").
- Using Basic over plain HTTP, even on an internal network.
- One shared password for the whole team: no way to tell who did what, and every departure means a change for everybody.
- Using it for customer sign-in instead of a session with lockout and multi-factor checks.
- Never rotating the password because "nobody knows it" while it sits in old chat messages and scripts.
- Counting a repeated 401 as harmless: a run of failed attempts against one URL is a guessing attempt and should trigger a limit.
Basic authentication and TapCub
TapCub does not provide, manage or proxy authentication for your site or API, and it has no Basic authentication interface. It only measures what happens on your pages. What you can do in practice:
- Do not send credentials as data. In All-platform analytics › Data › Tracking plan, write down each event's properties (name, type, description) and review the list for anything that looks like a password, token or
Authorizationvalue. Such fields do not belong in analytics. - Know what is not recorded. Form auto-collection is off by default; when turned on it records only a form's id, name and action, not what was typed, so a login form's password field is never read.
- Check imported logs first. If you import web server logs through All-platform analytics › Data › Data import, make sure the log format does not include the
Authorizationheader or URLs with embedded credentials. - Use analytics to see who reaches a locked area. Status codes such as 401 need server collection or a log import; the page script alone does not see them.
TapCub does not rate-limit, block or authenticate traffic; for that, use your web server, gateway or CDN.
Sources
- IETF, RFC 7617: The 'Basic' HTTP Authentication Scheme (2015).
- IETF, RFC 9110: HTTP Semantics, section 11 (HTTP Authentication) (2022).
- IETF, RFC 6750: The OAuth 2.0 Authorization Framework: Bearer Token Usage (2012).
- MDN Web Docs, HTTP authentication.
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Data Analyst
Explores traffic sources, conversion funnels, and retention, using clear metric definitions and concrete examples to explain what the numbers mean.