skip to content

Which authentication schemes does the `auth.type` enum in the Postman collection format declare?

level: middleimportance: should knowfreq 45%

answer

  1. The selector is constrained by an enum
  2. Eleven values, all lower-case and unbroken
  3. One value carries no settings array
  4. The AWS value keeps its v
  5. OAuth appears twice, as two values

basics

~10 s

The collection format's auth.type enum declares eleven values: apikey, awsv4, basic, bearer, digest, edgegrid, hawk, noauth, oauth1, oauth2 and ntlm. Every one except noauth also has a matching attribute array.

solid answer

~40 s

The format's `auth.type` is a string constrained by an enum of eleven values: `apikey`, `awsv4`, `basic`, `bearer`, `digest`, `edgegrid`, `hawk`, `noauth`, `oauth1`, `oauth2` and `ntlm`. Ten of them also have a matching property declared beside `type` — an array of auth attributes carrying that scheme's settings. `noauth` is the odd one out: the format declares it as an **empty schema** with a comment saying anything is allowed, so no attribute array is defined for it. Two spellings catch people out: the AWS signing scheme is `awsv4`, and the OAuth values carry their generation in the name as `oauth1` and `oauth2`. This enum is the **format's declaration** only; what a runner ships handlers for is a separate question with a different answer.

go deeper

for a junior

Be ready to name several declared values and to say that the selector is constrained by a fixed list rather than being free text.

for a middle

Explain that ten values carry a matching attribute array and one does not, and get the exact spellings right, including the AWS value.

for a senior

Show you know when the enum is actually enforced: at validation and conversion time, not when a runner loads a document and executes it.

for a principal

Own the consequence for tooling policy: pinning to the declared enum buys portability across validators, at the cost of ruling out schemes a runner can nonetheless execute.

## The declared list In the collection format, the `auth` object's `type` member is a string with an **enum constraint**. Any document validated against that schema must use one of these values: - `apikey` - `awsv4` - `basic` - `bearer` - `digest` - `edgegrid` - `hawk` - `noauth` - `oauth1` - `oauth2` - `ntlm` Eleven values, and that is the whole declared surface. `type` is also the auth object's **only required member**, so a file that omits it fails validation even if a scheme array is present and fully populated. ## Every value but one has a settings array Beside `type`, the format declares one property per scheme, named for the scheme, whose contents are an array of auth attributes. The exception is `noauth`, declared as an empty schema — the format's own comment on that line says anything is allowed under it, and in practice a `noauth` selection carries nothing. | `auth.type` value | Settings property declared beside it | |---|---| | `apikey` | `apikey` array of auth attributes | | `awsv4` | `awsv4` array of auth attributes | | `basic` | `basic` array of auth attributes | | `bearer` | `bearer` array of auth attributes | | `digest` | `digest` array of auth attributes | | `edgegrid` | `edgegrid` array of auth attributes | | `hawk` | `hawk` array of auth attributes | | `ntlm` | `ntlm` array of auth attributes | | `oauth1` | `oauth1` array of auth attributes | | `oauth2` | `oauth2` array of auth attributes | | `noauth` | none — declared as an empty schema | Note that the scheme arrays are all **optional**. Only the selector is mandatory, so `{"type": "basic"}` with no `basic` array is a perfectly valid auth object — it simply gives a signing handler nothing to work with. ## Spellings that catch people out - **`awsv4`.** The enum spells the AWS signing scheme `awsv4`, with the `v`. The file that implements the handler in a runner is named `aws4.js`, without it, and the handler is registered under the enum's spelling. If you are writing the value into a document by hand, `awsv4` is the one that matters; `aws4` is a source-file name and never appears as an `auth.type` value. - **`oauth1` and `oauth2`** are two separate enum values with two separate attribute arrays. They are not one value with a parameter. - **Everything is lower-case and unbroken.** No enum value uses camel case, a hyphen, or an underscore. `apiKey`, `no-auth` and `bearerToken` are all wrong, and none of them will be recognised anywhere. ## What this enum is, and what it is not The enum is the **file format's declaration** of which scheme names a document may legally use. That is a narrower statement than it sounds: 1. **It is not a capability list for a runner.** A program that executes collections keeps its own registry of signing handlers, which is a different set built by a different project. Do not read the enum as "the schemes that work". 2. **It is not enforced by the SDK.** The object model that loads a collection in memory does its own, far looser check on the scheme name and does not consult this enum at all. 3. **It is only enforced when something validates.** Importers, linters, schema-driven editors and converters that check a document against the published collection schema will reject a value outside the enum. A runner that simply loads and executes will not. The practical rule: when you are asked what auth types the format supports, answer with these eleven and say explicitly that you are quoting the **format's enum**. Presenting a merged list of "everything the enum declares plus everything a runner implements" is a factual error, because the two sets genuinely differ and each belongs to a different authority.

  • Which declared `auth.type` value has no attribute array defined beside it, and why?
    `noauth`. The format declares it as an empty schema, with a comment stating that anything is allowed there. It selects a scheme that has nothing to configure, so there are no parameters to store and no array shape to constrain.
  • Is a collection with `"auth": {"type": "basic"}` and no `basic` array valid against the format?
    Yes. `type` is the auth object's only required member, and every scheme-specific array is optional. The document validates cleanly. What it does not do is give a signing handler any parameters, so the scheme is selected with nothing behind it.

saying these in an interview costs you the question

  • Answers with a merged list of declared and runner-implemented schemes
  • Writes the AWS value as aws4 rather than awsv4
  • Uses camel case such as apiKey for an enum value
  • Claims every enum value has a matching attribute array
  • Says the scheme arrays are required alongside the selector