postman-app-support icon indicating copy to clipboard operation
postman-app-support copied to clipboard

Document generated code snippet missing Authorization header

Open wessRay opened this issue 4 years ago • 7 comments

Is there an existing issue for this?

  • [X] I have searched the tracker for existing similar issues

Describe the Issue

Generating code snippet of the request in POSTMAN APP is as expected, the header "Authorization" is generated correctly.

But if the API is published as documentation, it is not showing the header when generate the curl command. You may refer to the following screenshot, this is the documentation that I published from my API collection image

Steps To Reproduce

  1. Create an API request in your API collection, by ticking "Inherit auth from parent"
  2. Right click the API collection > View documentation
  3. Publish the documentation.
  4. Check the link, and you will see the curl is not generating Authorization header.

Screenshots or Videos

No response

Environment Information

- Operating System: macOS Monterey
- Platform Type: Native App / Postman Documenter
- Postman Version: 9.15.4

Additional Context?

No response

wessRay avatar Mar 25 '22 05:03 wessRay

Hey @wessRay, thanks for sharing your feedback. We will look into this and keep you posted.

Raja-Simha avatar Apr 11 '22 13:04 Raja-Simha

yes. please. this is very troublesome

wessRay avatar Apr 12 '22 07:04 wessRay

@wessRay We are considering a few security concerns about adding Auth information in the generated Code snippets. We will keep you updated with our decision 🙇

akshaydeo avatar Apr 18 '22 04:04 akshaydeo

Hi @akshaydeo . thank you. i think most of us doesn't need the actual value of token being generated to code snippets. perhaps POSTMAN team can generate a variable placeholder for us?

for example:

curl --location --request POST 'https://api.example.com/api/auth/me' \
--header "Authorization: Bearer $TOKEN" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

at least with this, we will able to declare the $TOKEN variable first before we use the curl command?

wessRay avatar Apr 20 '22 04:04 wessRay

Any updates?

omair-inam avatar Oct 12 '23 19:10 omair-inam

Nothing yet?

somoza avatar Mar 17 '25 14:03 somoza

Any updates?

donaldzou avatar Mar 21 '25 15:03 donaldzou

I'm also looking for this. If security is a concern, an option in the collection to add or not the auth in the request example would be great.

iagoccampos avatar May 20 '25 21:05 iagoccampos