Authentication is the process of verifying a user’s credentials, such as a username and password, to confirm the user’s identity. Authentication protects data from unauthorized access.

The most common authentication methods include:

  • username and password
  • biometric data (fingerprint, face recognition)
  • tokens and certificates
Cat's paw phone biometry

How to ensure security?

User side

Strong password: use a combination of letters, numbers, and symbols.

Password updates: change passwords at least every few months.

Software updates: install updates promptly to fix vulnerabilities.

Application side

Multi-factor authentication: additional checks, such as sending a code to a phone.

Password storage: use secure encryption algorithms.

Software updates: install updates promptly to fix vulnerabilities.

How does an HTTP authentication request work?

When we enter login/password and click «Login», the browser sends an HTTP request, for example:

HTTP method POST
URL address https://tester-today.com/login
Header Content-Type: application/json
Request body { "username": "login", "password": "pass" }

If authentication succeeds, the server responds with HTTP status  200 OK

If the client’s data does not match the data on the server, it returns an HTTP status  401 Unauthorized

Why should GET not be used for authentication?

With the GET method, data is usually sent directly in the URL.

🔒 https://www.example.com/login?username=login&password=pass

This may lead to data leakage because of:

  • displaying user data in the address bar;
  • the user might save the URL as a bookmark;
  • the browser may cache pages requested via GET;
  • the browser keeps request history with visible URLs.

Use the HTTP POST method to send login and password.

Authorization header

In addition to form-based authentication, where data is sent in the request body, credentials can also be sent in the HTTP header Authorization . Often this is handled automatically by client libraries.

The Authorization header supports several authentication schemes:

Bearer

The client receives a token after login and sends it with each request.

Authorization: Bearer <токен>

Basic

The username and password are encoded using Base64. The data can be easily decoded.

Authorization: Basic YWRtaW46cGFzc3dvcmQ=

API Key

The client sends a unique key. It can be passed in any header or as a query parameter.

X-API-Key: 123456789abcdef
Task
Task available to premium users!
Sidebar arrow