Hide Authorization token in newman HTML reports

Hi Guys,

Please help me in hiding or disabling Oauth token on html report.

Thanks,
Rajesh

Hey @rajyy

Welcome to the community! :slight_smile:

In the latest version, you should be able to run this from the CLI with the Newman run command

--reporter-htmlextra-skipHeaders Authorization

1 Like

Hi @danny-dainton,

Thank you so much for the quick response. I have used skipHeaders but still no use. I’m getting the Authorization token on my report all the time. I’ll share you the command and piece of js script which I used. Please take a look at it.

From CLI:

newman run collection.json -e environment.json -g globals.json -r htmlextra --reporter-htmlextra-skipHeaders Authorization

Script - 1:

const newman = require('newman');

newman.run({
    collection: require('./collection.json'), 
    environment: require('./environment.json'),
    globals: require('./globals.json'),
    reporters: 'htmlextra',
    reporter: {
        htmlextra: {
            export: '' ,
             skipHeaders: ['Authorization']
        }
    }  

Script - 2:

const newman = require('newman');

newman.run({
    collection: require('./collection.json'),
    environment: require('./environment.json'),
    globals: require('./globals.json'),
    reporters: 'htmlextra',
    reporter: {
        htmlextra: { 
            export: '',
             skipSensitiveData: true
        }
    }

Which version of the reporter are you using?

These CLI flags only recently came into the reporter on the 1.8.9 version. If you’re running an older version of the app, these options won’t change anything in the report.

From the CLI you could use npm i -g newman-reporter-htmlextra or use npm i -S newman-reporter-htmlextra in the project dir, where you created the JS Script.

These are two examples that you could use to see this working.

This is excluding the Authorization Header:

newman run https://www.getpostman.com/collections/631643-f695cab7-6878-eb55-7943-ad88e1ccfd65-JsLv --folder 'Authentication Methods' -r htmlextra --reporter-htmlextra-skipHeaders Authorization

This is excluding all Request/Response Headers and Request/Response Body data:

newman run https://www.getpostman.com/collections/631643-f695cab7-6878-eb55-7943-ad88e1ccfd65-JsLv -r htmlextra --reporter-htmlextra-skipSensitiveData

Hi @danny-dainton,

Thank you so much for your support. It worked after updating newman

Cheers!!!

Regards,
Rajesh Kumar

1 Like