Client:
username = "alice"
secretKey = "12345"
method = GET
url = "https://example.com/private"
Client sends what it essentially this HTTP request:
method = GET
URL = "https://example.com/private"
header["Basic"] = "alice:12345"
Server:
It receives:
method = GET
URL = "https://example.com/private"
header["Basic"] = (alice,12345)
It does:
(username, password) = header["Basic"]
Then:
if (password == datastore.get_user(username).password) authorised!
Problems with this method:
- Username and password are sent with every request in plaintext.
- Request is encrypted with TLS due to the
HTTPS
, but this isn't super trustworthy encryption. - If someone gets hold of the plaintext HTTP request, they now have the password and can make unlimited requests with it.