5

I have set up a release pipeline to automatically deploy an API artefact to a particular domain, and as part of that pipeline I have introduced the execution of a postman collection via the Newman CLI, the ultimate goal that I want to achieve with this is a post-deployment "integration test".

My API is secured using Identity Server 4 and there is a client created that uses the grant type "authorisation_code"

I am able to manually create an access token through the "Get New Access Token" feature of Postman, but there doesn't seem to be a way to get a new token when running through the collection runner. Nor can I find a way to do this via the NewMan CLI thus these test responses come back as "401".

Does anybody know of a way to retrieve an authorisation code / access token within postman pre-request scripts or a way to ensure that an access token is requested when running through the collection runner or via Newman CLI?

BTW I don't mind supplying test creds through an environment file.

Dave Morrison
  • 190
  • 2
  • 13
  • Seems like it is possible via `pm.sendRequest` in the pre-request script, see: https://github.com/postmanlabs/postman-app-support/issues/2050 – Christian Baumann Oct 06 '20 at 19:10
  • Ta, i have been looking at this, BeingSujeetK commented on 13 Sep 2019 "It would be much convenient for the user if this could be automated through the pre-request scripts." this is exactly what i am trying to achieve, but there arent any examples – Dave Morrison Oct 07 '20 at 14:51

0 Answers0