How to turn Bearer Token into a variable and refresh it before each request automatically using external API "refresh token" URL?

I believe its about scripts.

I should go like this, I believe:

  1. Use pre-request script to refresh token,
  2. Pass received token into a variable
  3. Use this variable in all further requests header

Any script example for (1), please?

Thanks ahead!

Hey @Ziggizag

This is quite common question, I found this link to a post by @allenheltondev:

There are a few other examples in the fourm too.

2 Likes

Thanks for chiming in and sharing these examples, @danny-dainton ! Iā€™m going to close this thread now. @Ziggizag if you get stuck again after trying those examples, I recommend starting another thread so people can help with specific problems :slight_smile: