Authorisation types in Postman
Postman supports Bearer Token, Basic, API Key, OAuth 2.0 and other types, with authorisation set on the collection, folder or request and inherited. Login and public endpoints get No Auth. Basic is only Base64 encoding, so it is checked over HTTPS, and an API key is better sent in a header because a query string ends up in logs. A collection is not exported with secret values.
API · Authorization
A collection has 80 requests and the token changed. How many places need fixing?
A Postman collection has 80 requests. Someone pasted a Bearer token into each one, now it has expired, and every request returns 401. Nobody wants to fix 80 tabs by hand, and if even one is missed, it will quietly fail a few days later. Authorization types are not just a list in a drop-down: the question is where it is set and what exactly ends up in the request.
Below: what each type does, how inheritance removes duplication, and where each type has a risk.
Authorization types and how they look in a request
| Type | What goes in the request | Risk |
|---|---|---|
| Bearer Token | Authorization: Bearer <token> | The token works until it expires; theft gives access |
| Basic Auth | Authorization: Basic base64(login:password) | It is encoding, not encryption |
| API Key | A header (x-api-key) or a query | In a query it lands in logs and history |
| OAuth 2.0 | Postman runs the flow and inserts the access token | Harder to set up, but the token is short-lived |
| Cookie session | Not a separate type in the Authorization tab: Postman stores the session cookie after login and sends it itself | Needs CSRF protection, and a cookie is not added to another domain automatically |
The same from the command line, to see what exactly goes into the request without Postman:
# Bearer
curl -i "$BASE/v1/me" -H "Authorization: Bearer $TOKEN"
# Basic: curl builds base64("login:password") itself
curl -i -u "test:password" "$BASE/v1/me"
# the same by hand: Authorization: Basic dGVzdDpwYXNzd29yZA==
# API key in a header, and in the query (the second one lands in logs)
curl -i "$BASE/v1/me" -H "x-api-key: $KEY"
curl -i "$BASE/v1/me?api_key=$KEY"
# Cookie session: the cookie is set by login, then sent back
curl -i -c jar.txt -X POST "$BASE/auth/login" -d '{"login":"test"}' \
-H "Content-Type: application/json"
curl -i -b jar.txt "$BASE/v1/me"
How inheritance works and why it is needed
Auth can be set at three levels: collection, folder, request. The request mode Inherit auth from parent takes the setting of the nearest parent that sets it. Login and public endpoints get No Auth, so they can be tested without a token.
Where a request gets its authorization
Why it is designed this way. Auth repeated in 80 places inevitably drifts: one request has an old token, another a foreign one, a third none at all. A central place is changed once, and a test with No Auth is then a conscious exception, not an accident. One more benefit: to check "without a token", you switch the mode on one request without touching the collection.
Example: where exactly the risk hides
The Basic test for an internal service passes. The real request looks like this:
GET /v1/me HTTP/1.1
Authorization: Basic dGVzdDpwYXNzd29yZA==
# decode in a shell: echo dGVzdDpwYXNzd29yZA== | base64 -d
# result: test:password
The login and password are recovered in a second, so over HTTP without TLS they go practically in plain text. First test: the service opens only over HTTPS, and on http:// it either rejects the request or redirects (301/308) and in no case processes the credentials. Second test: a wrong password gives 401 with WWW-Authenticate: Basic. For an API Key it is similar: a key in a header is the norm, a key in the query is a design remark, because the URL is written to server and proxy logs and stays in the browser history.
Token or cookie session
Bearer token
The client adds the header itself. Independent of a browser, handy for mobile and service-to-service. Needs no CSRF protection.
Cookie session
The browser adds the cookie itself. Handy for the web, but needs HttpOnly, Secure, SameSite and CSRF protection.
Limits and alternatives
- Postman also has Digest, Hawk, AWS Signature, NTLM and other types. They are rarely asked about in interviews, and at work they appear in specific integrations.
- Values of variables with secrets are kept in the environment, not in a collection that is exported to a repository. For sharing, use the built-in vault or CI variables.
- In Playwright or curl the same types are set by a header or an option (
-u,extraHTTPHeaders). The principle does not depend on the tool. - Postman Inherit is only a way to pass the token. Whether the server handles it correctly must be checked with separate cases.
Common mistakes
- Pasting the token into every request. A week later some requests fail with 401 and the cause takes long to find.
- Leaving Inherit on login. It sends an old token to an endpoint that does not expect one, and the result is confusing.
- Considering Basic safe. Base64 decodes in a second, and without HTTPS it is plain text.
- Exporting a collection with a real token. The secret ends up in the repository. Export variables without values.
Check yourself
A request in Inherit mode returns 401 although the collection has a token. What to check first?
Answer
Whether the collection or a folder in between really sets auth, and whether the {{token}} variable has a value in the active environment. An empty variable gives a Bearer header with no token. The Postman console shows what exactly went into the request.
Why is an API Key in a query parameter worse than in a header?
Answer
The URL is written to server and proxy logs, stays in the browser history and can leak through Referer. Headers are not logged that way by default, so the key is safer there.