Newman 9.11.1 does not fill in Authorization header for OAuth 2.0
See original GitHub issue-
Newman Version: v9.11.1 win32 x64
-
OS details: Windows Server 2016, node 5.6.0:
-
Are you using Newman as a library, or via the CLI? CLI
-
Did you encounter this recently, or has this bug always been there: Not present on Windows 10 with node v8.10.0, newman 9.8.3
-
Expected behaviour: Newman to fill in Authorization header as specified in OAuth 2.0 settings
-
Command / script used to run Newman:
newman run <collection.json> -e <environment.json> -d <test-data.json> --reporters cli,json,junit --disable-unicode -x
-
Sample collection, and auxiliary files (minus the sensitive details): tests.postman_collection.json test.postman_environment.json test-data.json outputfile.json
-
Screenshots (if applicable):
With the OAuth set to OAuth 2.0 and no Authorization header specified (result from sample collection)
2018-04-26T17:44:20.4056851Z Root Get User
2018-04-26T17:44:20.5306950Z GET https://hostname/324201/scim/v2/users/user.23 [401 Unauthorized, 457B, 62ms]
2018-04-26T17:44:20.6088332Z 1. GET USER: User data is correct
2018-04-26T17:44:20.6088332Z Pass GET USER: Content-Type is present
2018-04-26T17:44:20.6088332Z Pass GET USER: Response time is less than 1500ms
2018-04-26T17:44:20.6088332Z 2. GET USER: Status code is 200
2018-04-26T17:44:20.6400802Z 3. GET USER: JSON schema validation failed. ValidationError: Missing required property: id
When OAuth is set to None and the Authorization header is set to “Bearer token”
2018-04-26T21:32:14.3940917Z Root Get User
2018-04-26T21:32:14.5190806Z GET https://hostname/324201/scim/v2/users/user.23 2Γáä JSONError in test-script
When OAuth is set to OAuth 2.0 and the Authorization header is set to “Bearer token”
2018-04-26T22:22:42.7181640Z GET https://hostname/324201/scim/v2/users/user.23 [200 OK, 1.47KB, 156ms]
2018-04-26T22:22:42.7806681Z Pass GET USER: User data is correct
2018-04-26T22:22:42.7806681Z Pass GET USER: Content-Type is present
2018-04-26T22:22:42.7963022Z Pass GET USER: Response time is less than 1500ms
2018-04-26T22:22:42.7963022Z Pass GET USER: Status code is 200
2018-04-26T22:22:42.8119210Z Pass GET USER: Valid JSON schema
-
Steps to reproduce the problem:
npm install newman
newman run collection.json -e environment.json> -d <test-data.json> --reporters cli,json,junit --disable-unicode -x
- Inspection of the result JSON file shows that the accessToken is set as an environment variable, and that the OAuth settings are not filled in.
- When I set OAuth to none, and defined the Authorization header, the output showed JSON errors, as seen in the second output sample.
- When I set OAuth to OAuth 2.0 and defined the Authorization header, the token was sent, and I got expected output.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Yeah I think this still is happening, I just opened a support issue through Postman support for I’m pretty sure the exact same thing.
It is Postman Support Issue 67107, and I had recorded a video to explain what I was seeing. We’ve been utilizing pm.sendRequest in pre-request scripts in order to work around this issue I believe but it’s come to ahead where we now need to no longer use that in order to implement another tool we’d like to use, and I was not aware until recently that it seems like it should actually have the ability to do this without having to use pre-request scripts.