Basic Authentication Failing w/ newman

I have v3.8.1 of newman. Tried running a request via newman command line with Basic authentication but it fails with 401 unauthorized. I have the Authorization Header username/password specified via my environment file .

The same request works just fine with postman / runner.

What am I missing ?

1 Like

@rajagp

What are you executing on the command line … what does your command string look like ?

newman run SGWPublic.postman_collection.json -e DemoEnv.postman_environment.json

My …environment.json includes “name” and “password” variables.

This is snippet of my request. Notice the “name” and “password”

 "request": {
                          "auth": {
                              "type": "basic",
                               "basic": [
                                  {
                                                "key": "password",
                                                   "value": "{{password}}",
                                                     "type": "string"
                                  },
                                   {
                                                 "key": "username",
                                                   "value": "{{name}}",
                                                    "type": "string"
                                  }
                            ]
                   },
                       "method": "PUT",
                                 "header": [
                                           {
                                                   "key": "Content-Type",
                                                   "value": "application/json"
                                          }
                                  ],
                                    "body": {
                                                        "mode": "raw",
                                                        "raw": "{\n\"value\":\"{{body}}\"\n}"
                                                },
                                                "url": {
                                                        "raw": "{{publicurl}}/{{db}}/{{doc}}",
                                                        "host": [
                                                                "{{publicurl}}"
                                                        ],
                                                        "path": [
                                                                "{{db}}",
                                                                "{{doc}}"
                                                        ]
                                                },
                                                "description": ""

Sorry, but I am at a loss now too.

@rajagp Could you confirm if this is still an issue with Newman v3.10.0? If so, could you share the smallest possible collection that helps us debug this? Thanks! :smile:

Hi Team - Is this issue fixed in the latest version of newman. When we pass basic auth details in postman, my collection is working as expected. When we run the same collection from newman it is failing with “CONNECT ETIMEDOUT” error

Hi Team, I’m also facing similar issue. I’m using newman v3.10.0.
I get this error (when run from jenkins) through CLI:
┌
│ e[90m’runtime~basic.auth: could not sign the request:
│ binary is not a function’e[39m, [TypeError: binary is
│ not a function]
â””

Please help. Thanks.

@SriNKumar It appears that you’re on Node v4, could you update Newman and Node to their latest versions?