# Automate Postman script

**URL:** <https://community.postman.com/t/automate-postman-script/78488>\
**Category:** Help Hub\
**Tags:** automation, jsondatafile\
**Created:** [April 14, 2025, 9:54am UTC](https://community.postman.com/t/automate-postman-script/78488 "2025-04-14T09:54:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arnab-das1-d908282e](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@arnab-das1-d908282e](https://community.postman.com/u/arnab-das1-d908282e)\
**Post date:** [April 14, 2025, 9:54am UTC](https://community.postman.com/t/automate-postman-script/78488/1 "2025-04-14T09:54:46Z")

</div>

Hello,  
We are trying to generate the access token using postman Auth Type = OAuth 2.0 and to use the token for SAS application. For Grant Type I am using Grant Type = Authorization Code. Then I click on Get Access New Token and it asks for authentication. After successful authentication it creates the Access\_Token.

questions :

1. We can see the Access Token created as json file in Console tab \> POST \> Response Body. Please find the screenshot. Is it possible to directly save the json file locally ? or where the Json file is getting saved ?

2. Is it possible to automate the whole process (to trigger with shell script) and run the postman script to generate the access token ?

 ![2025-04-09 15_25_38-OAuth 2.0](https://us1.discourse-cdn.com/getpostman/original/3X/f/b/fb221858c5bc2dda1efd26af6097fb88e94e81ef.jpeg)  
 ![2025-04-09 15_28_13-OAuth 2.0](https://us1.discourse-cdn.com/getpostman/original/3X/6/6/6698ba17723076acd49802810bc1e394e88c0171.jpeg)  
 ![2025-04-09 15_30_17-OAuth 2.0](https://us1.discourse-cdn.com/getpostman/original/3X/5/2/524e83da152342910211436ccf3361988751ec53.jpeg)  
 ![json_file](https://us1.discourse-cdn.com/getpostman/original/3X/6/e/6e1a05239bf2e8e63db6791365f07b1c5609f018.jpeg)

---

<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 14, 2025, 11:12am UTC](https://community.postman.com/t/automate-postman-script/78488/2 "2025-04-14T11:12:44Z")

</div>

Hey @arnab-das1-d908282e 👋

Welcome to the Postman Community! :postman:

You might find more information around this on a previous topic:

> [@Pre-request script to automate authorization code grant type](https://community.postman.com/t/pre-request-script-to-automate-authorization-code-grant-type/45989):
>
> May i know outline or any examples about pre-request script to capture access token or bearer token when we have below information for “Authorization Code” grant type. BaseURL ClientId ClientSecret AuthURL AccessTokenURL redirect URL Scope Currently i am able to capture access token using - “Get New Access Token” button which will launch auth URL into browser and after providing username and password information and it will redirect to postman application with access token and which can …
