# Replicate Authorization Oauth2 form tab into pre request script

**URL:** <https://community.postman.com/t/replicate-authorization-oauth2-form-tab-into-pre-request-script/21505>\
**Category:** Help Hub\
**Created:** [March 17, 2021, 4:29pm UTC](https://community.postman.com/t/replicate-authorization-oauth2-form-tab-into-pre-request-script/21505 "2021-03-17T16:29:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodolvelasco](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/rodolvelasco/32/7691_2.png) [@rodolvelasco](https://community.postman.com/u/rodolvelasco)\
**Post date:** [March 17, 2021, 4:29pm UTC](https://community.postman.com/t/replicate-authorization-oauth2-form-tab-into-pre-request-script/21505/1 "2021-03-17T16:29:03Z")

</div>

I’m able to generate the client\_credentials token with form provided by Postman on Authorization tab but I would like to replicate this behaviour on Pre Request Script so I can retrieve the token automatically and use it on every request that then will be executed by Newman.

![image](https://us1.discourse-cdn.com/getpostman/original/3X/d/a/da965cfb75ee70a8c6a9e696e9a7e5009495caef.png)

But at this point I’m getting “Invalid token audience. Provided value [xxxx-xxxx…] does not match neither tenant configuration.”

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [April 9, 2025, 2:04pm UTC](https://community.postman.com/t/replicate-authorization-oauth2-form-tab-into-pre-request-script/21505/2 "2025-04-09T14:04:16Z")

</div>

Closed on April 9, 2025, 2:04pm UTC

Thanks for your post, and sorry we didn’t get to this sooner. This isn’t the experience we want for our users. [This post](https://community.postman.com/t/scripting-token-management/42949/3) might provide some insight into the structure of a _pre-request script_ to get a token.

Since the post is a bit older, we’re closing it to make room for newer discussions.
