veena444
(Veena Hegde)
March 25, 2024, 12:26pm
1
Hi,
I have successfully added Day 04-Authorization requests - Collection header, auth helper. But while submitting final collection getting below error.
Submit your solution is set to ‘Inherit auth from parent’ & added X-api-key at request level Header. Not understanding what I am missing.
Hey @veena444
Welcome to the Postman Community!
Do you have the correct Auth
set at the Collection level? If you click on the Day 04 Collection in the left sidebar and open this up in a new tab, does it contain the variable in the Authorization helper?
veena444
(Veena Hegde)
March 26, 2024, 5:30am
3
Hi Danny,
I did set the Auth at the collection level & X-api-key under variables. Below is the screenshot for the same. I might have made some silly mistake but I am feeling lost.
This is the failing test.
pm.test("Auth added correctly", () => {
pm.expect(collection.auth.type, 'check the collection auth type').equals("apikey")
pm.expect(collection.auth.apikey[0].value, 'check the api key').contains.oneOf(["X-api-key", "{{postman_api_key}}"])
pass += 1
})
This is because you have added the API Key wrong at the collection level. (Your first screenshot).
You’ve got it being added to “Query Params” where it should be the header.
veena444
(Veena Hegde)
March 26, 2024, 10:53am
5
Hi Mike,
This solved my problem.Thank you so much for your help.
system
(system)
Closed
April 24, 2024, 12:27pm
6
This topic was automatically closed after 30 days. New replies are no longer allowed.