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?
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.
Include screenshots and code snippets on how you are currently generating and setting the token. Collection variable, Environment, etc. (Redacted as appropriate).
Confirm its working ok in Postman first.
This functionality does work in Newman, so it will be related to how the token is being generated and saved.
I Found a solution it works with me… i duplicated my collection and renamed it with different name, then i deleted the old collection from postman and it works