Example:
@accessToken variable is something that always requires adding a new token whenever hit the login or auth API.
@hidaytrahman I didn't quite understand it, could you please explain it for me with more details?
@hidaytrahman check this link to learn how to use request variables
Let me brief.
Suppose I have a variable name accessToken, and I am putting this variable in every request which require authorization.
e.g. user/profile require token in header as a 'Bearer {{accessToken}}'
Currently, we assign value in accesToken manually, But I want to assign it dynamically from user/login API response which returns token, I want to assign the same token in accessToken variable.
So whenever I will hit user/login API it will always set the token to accessToken variable.
This will save time for entering tokens every time manually.
and it can be used in various scenarios.
We need a hook before sending a http request, we should be able to get new token assign it to accessToken variable. Right now its a manual process. Take the case of switching env, I have to set the value of accessToken again manually. I know I can set a constant accessToken for each env, but odic tokens have sliding expiration. Postman allows scripts or hooks the gets executed before making http calls. And these script/hooks also works off the env variables
@hidaytrahman You can do that using request variables.
Most helpful comment
Let me brief.
Suppose I have a variable name
accessToken, and I am putting this variable in every request which require authorization.e.g.
user/profilerequire token in header as a 'Bearer {{accessToken}}'Currently, we assign value in
accesTokenmanually, But I want to assign it dynamically fromuser/loginAPI response which returns token, I want to assign the same token inaccessTokenvariable.So whenever I will hit
user/loginAPI it will always set the token toaccessTokenvariable.This will save time for entering tokens every time manually.
and it can be used in various scenarios.