Day 04- Submit collection error

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 :wave:

Welcome to the Postman Community! :postman:

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?

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.

Hi Mike,

This solved my problem.Thank you so much for your help.

This topic was automatically closed after 30 days. New replies are no longer allowed.