Authorization
You can set authorization on a request, a folder or a collection. Postguy applies it when you send the request.
The generated header or query parameter shows in the request's header table. It is never saved into the collection file.
To edit auth, open the Authorization tab of a request or of a collection or folder. Every text field accepts {{variables}} (see Variables), except the OAuth 2.0 block (see OAuth 2.0).
Inheritance
| Where | Default | Inherit available |
|---|---|---|
| Collection | No Auth | no |
| Folder | Inherit | yes |
| Request | Inherit | yes |
Postguy picks the auth in this order:
- The request's own auth.
- Each folder, from the innermost to the outermost.
- The collection.
The first level that is not Inherit wins. No Auth counts as a result: it stops the search and sends nothing. The Inherit view shows the kind it inherits.
Auth kinds
The kind is the tag stored in the collection file.
Kind (kind) | UI label | Fields (file keys) | Applied on send |
|---|---|---|---|
inherit | Inherit | none | resolved to a parent, see above |
noauth | No Auth | none | nothing is added |
apikey | API Key | key, value, location (header or query) | yes. The key name must not be empty. A header of the same name is replaced. A query pair of the same name is replaced, otherwise appended. |
basic | Basic Auth | username, password | yes, Authorization: Basic <base64 of user:password> |
bearer | Bearer Token | token, prefix | yes, Authorization: <prefix> <token>. The prefix defaults to Bearer. A blank prefix sends the bare token. An empty token is an error. |
digest | Digest Auth | username, password, realm, nonce, nonceCount, algorithm, qop, opaque, clientNonce, disableRetryRequest | yes, see Digest |
jwt | JWT Bearer | location, algorithm, secret, secretIsBase64, privateKey, payload, prefix, headers | yes. The token is signed at send. iat is added unless the payload has it. In a header it is Authorization: <prefix> <token> (Bearer by default). In the query it is the parameter token. |
oauth1 | OAuth 1.0 | consumerKey, consumerSecret, token, tokenSecret, signatureMethod, callbackUrl, verifier, timestamp, nonce, version, realm, addParamsToHeader, includeBodyHash, addEmptyParamsToSign, encodeParamsInHeader | yes. The signature goes to the Authorization header, or into the query when addParamsToHeader is off. A random nonce is generated when nonce is empty. |
oauth2 | OAuth 2.0 | see OAuth 2.0 | yes, with a stored access token |
awsv4 | AWS Signature v4 | accessKey, secretKey, region, service, sessionToken, addAuthDataToQuery | yes. Signed headers are added. With addAuthDataToQuery, the signature goes into the query instead of the Authorization header. |
hawk | Hawk | authId, authKey, algorithm, user, nonce, ext, appId, dlg, timestamp, includePayloadHash | yes, Authorization header |
ntlm | none | username, password, domain, workstation, disableRetry | no, stored only |
edgegrid | none | accessToken, clientToken, clientSecret, nonce, timestamp, baseUri, headersToSign, maxBody | no, stored only |
asap | none | algorithm, issuer, audience, keyId, privateKey, subject, additionalClaims, expiry | no, stored only |
| any other tag | none | everything is kept verbatim | no |
Algorithm and method values:
| Field | Values |
|---|---|
Digest algorithm | md5, md5Sess, sha256, sha256Sess, sha512256 |
Hawk algorithm | sha256, sha1 |
JWT algorithm | hs256, hs384, hs512, rs256, rs384, rs512, es256, es384, es512, ps256, ps384, ps512 |
OAuth 1.0 signatureMethod | hmacSha1, hmacSha256, hmacSha512, rsaSha1, rsaSha256, rsaSha512, plaintext |
{{variable}} expansion on send covers Basic, Bearer, API Key, Digest, JWT, OAuth 1.0, AWS v4 and Hawk.
this auth type is not supported yet (v1 sends Basic, Bearer, API key, Digest, JWT, OAuth 1.0, AWS v4 and Hawk). The request is not sent unauthenticated.If the file names an auth kind this build does not know, Postguy keeps it as is. Resolving to it adds nothing to the request.
The selected kind is also exported and imported with Postman and OpenAPI documents. OpenAPI security schemes map to Basic, Bearer, API Key and OAuth 2.0.
Digest
- With a
noncefilled in: Postguy answers directly from the stored challenge values. - With an empty
nonce: Postguy first sends the request without credentials. If the server replies401with aWWW-Authenticateheader, Postguy computes the answer from that challenge and retries once. The console shows the warningDigest challenge accepted; request retried once.
Turn on disableRetryRequest to send only the first request and see the 401 yourself. An empty clientNonce generates a random one.
OAuth 2.0
Grants
| Grant (UI) | File value | Token flow |
|---|---|---|
| Authorization Code | authorizationCode (default) | system browser plus a loopback listener |
| Authorization Code (PKCE) | authorizationCodeWithPkce | the same, with a PKCE challenge |
| Implicit | implicit | not wired: the button is disabled |
| Password Credentials | passwordCredentials | direct request to the token URL |
| Client Credentials | clientCredentials | direct request to the token URL |
Get a token
Fill in the fields, then press Get New Access Token.
| Field | Purpose |
|---|---|
Authorization URL | Browser step of the code grants. |
Token URL | Token endpoint for every grant. |
Refresh URL | Optional override for refreshing. The token URL is used when empty. |
Client ID, Client secret | Sent as a Basic header or in the body, see below. |
Scope, State | State is generated if empty. |
Callback URL | Filled in for you during a browser flow. |
Username, Password | Password grant only. |
Header prefix, Token name (URL) | How the token is added to a request, see below. |
Extra params | Key and value rows, each delivered in the body, the url or the headers. On the token request, only body rows are sent. On the authorization URL, every row is appended to the query. |
Access token, Refresh token | Filled by the flow. You can also type them. |
Client credentials and password grants send one request to the token URL.
The two code grants work like this:
- Postguy starts a listener on
127.0.0.1with an ephemeral port and builds the redirect URIhttp://127.0.0.1:<port>/callback. - It opens the authorization URL in your system browser with
response_type=codeand thestate. For PKCE it also sendscode_challengeandcode_challenge_method(S256, orPlain). - The listener waits up to five minutes for the redirect, checks
stateand takes the code. It reads at most an 8 KiB request line, then closes. - Postguy exchanges the code at the token URL (with the PKCE verifier for the PKCE grant).
The app shows progress and errors in its status text.
Authorize using browser is stored in the file as useBrowser. The app does not read it, so the code grants always use the browser.
Client authentication is Client secret in Basic header (default) or Client secret in body. The token request is a form POST with a 30 second timeout, a 4 MiB response cap and the global proxy and TLS settings.
Use the token
| Setting | Effect |
|---|---|
Header (default) | Authorization: <Header prefix> <token>. The prefix defaults to Bearer. |
URL | The token is appended to the query under Token name (URL), default access_token. |
A send fails in two cases:
- No token:
no access token; run the authorization flow first. - The stored expiry has passed and no refresh was possible:
the access token has expired; refresh it first.
Refresh and storage
- The
Refreshbutton is enabled when a refresh token exists.expires in <n>sshows next to it when the server reported an expiry. - Before a send, Postguy refreshes a token that is past its expiry, if there is a refresh token. The console warns
OAuth 2.0 access token refreshed. The new refresh token and scope replace the old ones when the server returns them. - Access and refresh tokens live in the workspace secrets file, not in the collection file, like secret variables. The UI masks them. Exports that strip secrets blank them. See Workspace and Import and export.
- The OAuth 2.0 block is not variable-expanded on send. Type literal values for URLs, client ID and secret.
Headless
oauth2_token runs a token flow for a request whose auth is OAuth 2.0 and stores the result. mode is one of:grant: client credentials or password.refresh.code: exchange an authorization code you got elsewhere, withverifierfor PKCE.
request_update (the definition is the serialized request). Send with request_send, which applies inherited auth, Digest retry and automatic refresh. Tools take ids, not names. See Automation tools.