# Set variables from outside of Postman (local script)

**URL:** <https://community.postman.com/t/set-variables-from-outside-of-postman-local-script/18201>\
**Category:** Help Hub\
**Tags:** variables\
**Created:** [December 3, 2020, 2:39pm UTC](https://community.postman.com/t/set-variables-from-outside-of-postman-local-script/18201 "2020-12-03T14:39:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luciano.junior](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/luciano.junior/32/6565_2.png) [@luciano.junior](https://community.postman.com/u/luciano.junior)\
**Post date:** [December 3, 2020, 2:39pm UTC](https://community.postman.com/t/set-variables-from-outside-of-postman-local-script/18201/1 "2020-12-03T14:39:31Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [December 4, 2020, 12:28pm UTC](https://community.postman.com/t/set-variables-from-outside-of-postman-local-script/18201/2 "2020-12-04T12:28:55Z")

</div>

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

> [@Medium Article: How to Automate OAuth2 Token Renewal in Postman](https://community.postman.com/t/medium-article-how-to-automate-oauth2-token-renewal-in-postman/6630):
>
> Hey everyone, I have seen on a number of forums and stack overflow articles people expressing their frustration with the manual process Postman has for renewing OAuth2 tokens when they expire. I thought I would share a write up I did to help you get past the manual process and have your tokens renewing automatically. Let me know what you think!

---

<div class="post-metadata">

**Author:** ![luciano.junior](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/luciano.junior/32/6565_2.png) [@luciano.junior](https://community.postman.com/u/luciano.junior)\
**Post date:** [December 4, 2020, 1:03pm UTC](https://community.postman.com/t/set-variables-from-outside-of-postman-local-script/18201/3 "2020-12-04T13:03:27Z")

</div>

That’s some great work, @allenheltondev!

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 🙂
