I guess that most developers have heard of, or used the API tool Postman. I use it every day to test and explore APIs. I used to find my self copying and pasting request headers and tokens for different environments (test, stage, production) I started to look for a better solution.
Turns out that Postman has a nice feature where you can put your authorization-settings on the parent folder to easily reuse these for all requests.
So when you click on a folder like this:
You'll get this view where you can add authorization-settings for all requests in that folder.
Sometimes however the standard options for authorization are not enough, some APIs might require more than one header, etc. In these scenarios the "Pre-request Scripts"-feature comes in really handy. It allows you to manipulate the request before it fires and allow us to configure common headers for all our requests.
Here is a example:
Just put this code in the Script-input to run it for every request: