0
0
Postmantesting~5 mins

Basic authentication in Postman

Choose your learning style9 modes available
Introduction

Basic authentication helps check who you are before letting you use a service. It keeps things safe by asking for a username and password.

When testing an API that needs a username and password to access data.
When you want to make sure only allowed users can get information from a server.
When you are learning how to secure web services with simple login checks.
When you want to quickly test if login details work without complex setups.
Syntax
Postman
In Postman, select the Authorization tab.
Choose 'Basic Auth' from the Type dropdown.
Enter your Username and Password.
Postman will add the Authorization header automatically.

Basic Auth sends your username and password encoded in base64.

Always use HTTPS to keep your credentials safe when using Basic Auth.

Examples
This sets the username to 'user123' and password to 'pass123' for the request.
Postman
Type: Basic Auth
Username: user123
Password: pass123
Use this to test admin access with username 'admin' and password 'secret'.
Postman
Type: Basic Auth
Username: admin
Password: secret
Sample Program

This is a GET request to an API with Basic Auth header. The string after 'Basic' is the base64 encoding of 'user123:pass123'.

Postman
GET https://api.example.com/data
Authorization: Basic dXNlcjEyMzpwYXNzMTIz
OutputSuccess
Important Notes

Basic Auth is simple but not very secure alone; always use it with HTTPS.

Postman helps by encoding credentials automatically, so you don't have to do it yourself.

Summary

Basic authentication uses username and password to protect access.

Postman makes it easy to add Basic Auth to your API requests.

Always test with secure connections to keep your info safe.