Skip to content
↑↓ move↵ openesc close

Authorization

Basic Auth

Send a username and password in the Authorization header, with the fields and a verified example.

1 min read

Use Basic Auth when the API documentation says “use basic authentication” or gives you a username and a password.

Request GET https://httpbin.org/basic-auth/user/passwd.

Type Basic Auth, Username user, Password passwd. Luvin sends:

Authorization: Basic dXNlcjpwYXNzd2Q=

The response is 200:

{
"authenticated": true,
"user": "user",
"authorized": true
}

dXNlcjpwYXNzd2Q= is user:passwd in base64. It is an encoding, not encryption: anyone who sees the header can read it. Use https. With a wrong password the API answers 401.

Field What to write
Username The user. Written to the file as typed.
Password The password. A secret field.
  • Luvin sends Authorization: Basic <base64 of username:password>.
  • If you wrote an Authorization header in Headers, yours wins and Luvin adds nothing.
  • With both fields empty, nothing is sent.
  • Works in requests, in the collection and in a workflow.

Password is a secret: typed as-is it is stored encrypted on your computer. Username is not a secret and goes to the file as typed. Use {{user}} and {{password}} to share the setup. See Secrets.

In a workflow, a contract that declares HTTP basic takes one value, user:password, in the environment. See Credentials of the contract.