In postman I have a collection, where each request uses collection-level Bearer Token authorization.
Now, what I would like to do is to send http request in my pre-request script (For refreshing access token), but I don't know is it possible to get access token (from collection Authorization) in pre-request scripts. I know I can get collection variables like
pm.collectionVariables.get("key)
,
but is there also a way to get (and also set) value from Authorization?
You can set the Token as a collection variable {{my_token}}
and then use
pm.collectionVariables.set("my_token", "tokenvaluehere")
in your pre-request script.