question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Newman 9.11.1 does not fill in Authorization header for OAuth 2.0

See original GitHub issue
  1. Newman Version: v9.11.1 win32 x64

  2. OS details: Windows Server 2016, node 5.6.0:

  3. Are you using Newman as a library, or via the CLI? CLI

  4. 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

  5. Expected behaviour: Newman to fill in Authorization header as specified in OAuth 2.0 settings

  6. Command / script used to run Newman: newman run <collection.json> -e <environment.json> -d <test-data.json> --reporters cli,json,junit --disable-unicode -x

  7. Sample collection, and auxiliary files (minus the sensitive details): tests.postman_collection.json test.postman_environment.json test-data.json outputfile.json

  8. 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
  1. Steps to reproduce the problem:

    1. npm install newman
    2. newman run collection.json -e environment.json> -d <test-data.json> --reporters cli,json,junit --disable-unicode -x
    3. 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.
    4. When I set OAuth to none, and defined the Authorization header, the output showed JSON errors, as seen in the second output sample.
    5. 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:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
Christopher-Kanecommented, Feb 5, 2021

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.

0reactions
Christopher-Kanecommented, Feb 5, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to perform OAuth 2.0 Authorization with Postman?
In this tutorial we will be using Postman to see the workflow of OAuth 2.0. For this, we will use imgur website API...
Read more >
Getting a Bearer Token in Postman / Newman Automatically ...
In the Collection, not one of the Requests, you will need to setup 2 things. Authorization Tab. In the Authorization Tab, set the...
Read more >
Authorizing requests - Postman Learning Center
In the Authorization tab for a request, select OAuth 2.0 from the Type dropdown list. Specify if you want pass the auth details...
Read more >
The OAuth 2.0 Authorization Framework: Bearer Token Usage
The Bearer authentication scheme is intended primarily for server authentication using the WWW-Authenticate and Authorization HTTP headers but does not ...
Read more >
How to develop test-automation using Postman when OAuth ...
In Get Token request, do this in Tests sections: ... In your main Get request, you can use the environment variable in Authorization...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found