Collection runs fine in Postman but fails with errors in Newman

Collection runs fine in Postman but fails with errors in Newman

When I run a collection in Postman, it runs successfully and all the tests are passing. But when I run it in newman with the command: newman run [collection_link]
, all tests fail with one common error, which is: [401 Unauthorized...]

I found the problem while trying to run collections using newman.

I have already tried to look through the community forum for answers, but I haven’t yet come across a helpful answer. I also found that @sankarasai18 reported a similar issue here but I couldn’t find any responses to that.
Anyone?

Hi @katamba

I would usually associate 401 Unauthorized with the user being restricted.

Are you passing any auth tokens in your collection?

Yes, there’s a Bearer token, which I stored inside a collection variable. What am failing to understand is why it’s restricting me in newman, and yet it runs successfully in Postman without any issues.

Are you sure that the token hasn’t expired or something like that?

Yes sir, I’ve actually regenerated the token, but still, the issue persists.