Auth: Set Bearer Token at the Collection level
Number of APIs: 1
⚠ This collection needs some changes before it's ready to use!
This is a collection based on Danny Dainton's blog post on how to dynamically set a Bearer Token before each request in a collection is sent. This is one of the most frequently asked question [on the community forum] too.
Before using it, update the following collection variables:
tokenBaseURL
: this should be the base URL for your auth service.
authData
: if your auth service requires any specific data, add it here as a JSON object
Once this is done, you can start using the collection. It will:
- Run the Pre-request Script at the collection level before every request
- If the
bearer-token
is not set, or if it has expired, it will request a new one and set it as a variable - All requests in the collection inherit from the collection level auth:

- Authenticated request GET {{tokenBaseURL}}