Enable Bearer Token Authorization in the Mock Server

Can I add Token-based authorization like Bearer Token in the mock server created through Postman? I want to serve the request through the mock server only if a valid token is passed in the request. If I can add it, please suggest a blog/guide or steps that I should follow to enable the Token-based authorization in the mock server.

Hey @JaapAnjaria :wave:

Are you talking about making the Mock Server private?

If so, that can be down when creating the server. Each request to the mock server would then require a valid API Token.

Hey @Danny Dainton,
I do know about the private mock servers having a Postman-generated API token. But, I was talking about the tokens that we pass in the Authorization Header to a REST server depending on its type like Basic Auth, OAuth 1.0, OAuth2.0 or Bearer Token. On the server side, authentication happens for the access key or token passed in the request. Thanks for your reply.

You could configure any header you like the the request / example and have that returned.

It’s not going to be the same as sending a normal request which would be validating the validity of the token though.

Variables can be used here to match a known good token value but that’s only really going to be returning an example of something that matches, rather than replicating an actual Auth flow.

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