问题
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.
来源:https://stackoverflow.com/questions/64229162/postman-access-token-retrieval-using-authorisation-code-grant-type