Set variables from outside of Postman (local script)

So, for calling my internal APIs I need an authorization token. This token is rotative and I can easily retrieve it on my computer (it’s store into a local file).

This means that every time the token rotates (~5 hours) I need to get the new token, open Postman’s variable editor and update my token variable.

What I’d like to know is if there’s any way to automate this process. I’m thinking maybe changing an internal file on my Postman installation where the variable is stored, so I could build a simple script that:

  1. Gets me updated token.
  2. Updates the variable on Postman.

I’ve tried creating a Post-Request script but it seems a bit of a overwork and a security vulnerability to have a local HTTP server serving my token.

Thanks,

You can take a look at this post and see if it does what you’re wanting:

1 Like

That’s some great work, @allen.helton!

I hadn’t explored the idea of oAuth refresh tokens because, for my use case, we often renovate the token ourselves with a simple script, but I’ll try to work with that.

Thanks :slight_smile:

1 Like