How do you mock authorization flows for an API?

I’m curious to find out how people create API mocks for authentication and authorization flows, either using Postman Mock Servers or any other tool.

For example, let’s say my API endpoints use OAuth 2.0. How would you recommend I create a mock to simulate those flows?

Hi @kaustavdm,

I used the postman interceptor to catch the authentication/authorization request. After it got logged into my history I saved it within the mock collection i am using. There I clicked ‘Send’ to retrieve a response body (in my case a bearer token), saved the response body as an example, set the unique url/path for that request and set the {{url}} so it would direct the request to my mock the next time i will send it.

I hope this helps you!

2 Likes

@Palmju This is a very impressive workflow! What was your use case?

I am doing end-to-end testing for a customer. In order to test their services without dependencies I have chosen to use postman to create mockservers so I can replace Api’s. That way I can preform behaviour driven development within their goal/requirements without being disturbed by changing data.

1 Like