# Automatically Request for authorization before test?

**URL:** <https://community.postman.com/t/automatically-request-for-authorization-before-test/9636>\
**Category:** Help Hub\
**Created:** [December 16, 2019, 1:20pm UTC](https://community.postman.com/t/automatically-request-for-authorization-before-test/9636 "2019-12-16T13:20:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hinewwiner](https://avatars.discourse-cdn.com/v4/letter/h/e19b73/32.png) [@hinewwiner](https://community.postman.com/u/hinewwiner)\
**Post date:** [December 16, 2019, 1:20pm UTC](https://community.postman.com/t/automatically-request-for-authorization-before-test/9636/1 "2019-12-16T13:20:27Z")

</div>

Hello, I am trying to write a test but have some problem. My API server is secured and require OAuth2 token before use. I can manually get access token by requesting it through ‘authorization’ tab but is there any way to automate so that Postman will automatically request the token before test?

(My token is only valid for 1hour so I need to renew while using it)

---

<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 16, 2019, 2:18pm UTC](https://community.postman.com/t/automatically-request-for-authorization-before-test/9636/2 "2019-12-16T14:18:34Z")

</div>

Yes, I actually wrote an article on how to do just that.

> [@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!
