Authorization in Monitor


I created a test in postman, which runs successfully. I added the test to the monitor, but it fails. He calls the correct link, so I think that the problem is the authorization.

In the ‘manual test’ I used the basic authorization, but I got the feeling that once the test runs in the monitor, the authorization values are not used.


Welcome to the community! :slight_smile:

I’m not entirely sure based on your information why that’s happening but I could provide a couple of different ways that you could add Authentication, that you could try out.

The basic auth is just creating a base64 encoded value of your username and password so it doesn’t need to use the Auth feature to achieve this for your request.

You could create this in a Pre-request Script, with the Crypto-JS library, then save the token value as an environment variable.

var CryptoJS = require("crypto-js")

var creds       = CryptoJS.enc.Utf8.parse(`${pm.environment.get('user')}:password`);
var base64Token = CryptoJS.enc.Base64.stringify(creds);

pm.environment.set("token", base64Token);

This can be referenced in the request header like this:

You could also use an external tool like base64encode to create the token value using your credentials.

The format required in the tool would be like this:


It will create a basic auth token like this:


You could then paste this hardcoded value into the request header - It should then authenticate your request.

Thanks!! :slight_smile: