Postman - Access Token Retrieval using Authorisation Code grant type

假如想象 提交于 2021-02-07 19:51:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!