Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postman custom authentication

Is there a way on Postman to pre-execute a request B before executing a request A ?

CONTEXT: I created a Symfony application that manages a set of webservices. Most of the routes can only be called once the user is fully authenticated (using form_login and firewall for those who are familiar with the framework)

Therefore, I have to call first:

POST /login

  • username
  • password

before being able to call

GET /some_secured_route

(that return a JSON response)

This works fine when I call the routes successively and manually in the Postman builder.


However, I'm trying to create a collection of test to run in the Postman runner. How can I invoke to call the the /login request before testing the a secured route ?

  • Is there a way to do so in the Pre-request script in the Postman builder ?
  • Postman supports several type of Authorization, (Basic Auth, Digest Auth, OAuth...). Does it support somehow a custome one ?

Any help or link to related post would be much appreciated. I wish you all a very good day.

like image 425
Pierre Roudaut Avatar asked Mar 08 '16 13:03

Pierre Roudaut


2 Answers

I don't think you can use a custom authentication mode in Postman. I think what you need is Jetpacks for Postman.

Chain requests together: Environment and global variables can be set inside the JS test script. You can extract data from one request and use it inside another request. This allows you to chain multiple requests together.

like image 189
Philipp Stauss Avatar answered Nov 07 '22 22:11

Philipp Stauss


Now you can use postman interceptor as describer here: https://community.getpostman.com/t/interceptor-integration-for-postman-native-apps/5290

like image 29
4givN Avatar answered Nov 07 '22 22:11

4givN