#2996·newman

Feature request: support OAuth2 client credentials from the collection Authorization tab (JSON "auth" key)

Author: bchociejCreated Jul 26, 2022Updated May 11, 2026
Labelsfeatureproduct/newman

Related: #191 #2615 #2724

This behavior has been discussed at length already including in the above issues. This post is more formally a request to implement the desired behavior.

Specifically, please consider supporting OAuth2 client credentials when they have been configured under the "Authorization" tab for the collection in the Postman UI (equivalent to the "auth" key in collection JSON).

Obviously, a lot of OAuth2 grant types are interactive and so are not really compatible with newman, but client_credentials is non-interactive and would provide a much easier way to configure tests than manually adding headers for every test.

Here is an example of the "auth" key excerpt from a Postman collection JSON file that I would expect to be supported:

json
{
        "info": {...},
        "item": [...],
        "auth": {
                "type": "oauth2",
                "oauth2": [
                        {
                                "key": "tokenName",
                                "value": "My OAuth Token",
                                "type": "string"
                        },
                        {
                                "key": "accessTokenUrl",
                                "value": "{{baseUrl}}/oauth/token",
                                "type": "string"
                        },
                        {
                                "key": "client_authentication",
                                "value": "body",
                                "type": "string"
                        },
                        {
                                "key": "clientSecret",
                                "value": "{{client_secret}}",
                                "type": "string"
                        },
                        {
                                "key": "clientId",
                                "value": "{{client_id}}",
                                "type": "string"
                        },
                        {
                                "key": "grant_type",
                                "value": "client_credentials",
                                "type": "string"
                        },
                        {
                                "key": "addTokenTo",
                                "value": "header",
                                "type": "string"
                        }
                ]
        }
}
  1. Newman Version (can be found via newman -v): 5.3.2
  2. OS details (type, version, and architecture): multiple (OSX Big Sur, Monterey; Alpine Linux 3.16 via Docker)
  3. Are you using Newman as a library, or via the CLI? library, but should apply to either
  4. Did you encounter this recently, or has this bug always been there: n/a
  5. Expected behaviour: OAuth client credentials grant type is supported
  6. Command / script used to run Newman: See below
  7. Sample collection, and auxiliary files (minus the sensitive details): See above
  8. Screenshots (if applicable): n/a

Newman library call:

javascript
    newman.run({
        collection: require('./postman_collection.json'),
        environment: {},
        reporters: ['cli', 'htmlextra'],
        reporter: {
            htmlextra: {
                export: outputFile,
            },
        },
    }, async (error, summary) => {
        // ...
    })