# Save Access Token in Postman

**URL:** <https://developer.sailpoint.com/discuss/t/save-access-token-in-postman/12809>\
**Category:** SHF Community Knowledge Base\
**Tags:** apis, identity-security-cloud, postman\
**Created:** [June 20, 2023, 1:58pm UTC](https://developer.sailpoint.com/discuss/t/save-access-token-in-postman/12809 "2023-06-20T13:58:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamnithesh](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/iamnithesh/32/4884_2.png) [@iamnithesh](https://developer.sailpoint.com/discuss/u/iamnithesh)\
**Post date:** [June 20, 2023, 1:58pm UTC](https://developer.sailpoint.com/discuss/t/save-access-token-in-postman/12809/1 "2023-06-20T13:58:11Z")

</div>

IMPORTANT: USE ONLY ON COMPUTERS THAT ARE NOT SHARED WITH OTHERS AND YOU ARE SURE THAT OTHERS CANNOT ACCESS

I wanted to share this with the community as I find this approach very helpful while using Postman to access various APIs. If you have been copying and pasting the access token after getting a new one every time it expires (like I used to do) this approach could make your life a little easier.

Step 1: Create a Environment, by clicking on the tiny icon to the right of “No Environment” and click on “Add” (screen-snip below)

 ![image](https://global.discourse-cdn.com/sailpoint/original/2X/9/917765640f973d23607a984bf73a3b7ca0b8e2d3.png)

Step 2: Add details as shown below

 ![image](https://global.discourse-cdn.com/sailpoint/original/2X/1/128475286adf4b194485418648a459d49449646a.png)  
Now click on 3 dots to the right of “Current Value” and click on Reset all. This will copy the values you entered under “Initial Value” column to “Current Value” column

Step 3: Create a new “POST” Request, with URL string `https://{{tenant}}.api.identitynow.com/oauth/token`

Update the Body of this request to as shown below:

 ![image](https://global.discourse-cdn.com/sailpoint/original/2X/4/41ec00a0f4afb2bff18dc49fc76c974aa625fc72.png)  
And add the below code to “Tests” section

```auto
pm.environment.set(
    "access_token", 
    pm.response.json().access_token
);

```

 ![image](https://global.discourse-cdn.com/sailpoint/original/2X/8/8dfba05f7491f2c8107f1127794a88a8d8d33953.png)

Step 4: Now update the “Authorization” tab of your collection as below

 ![image](https://global.discourse-cdn.com/sailpoint/original/2X/7/70cdc74e9f79229bb5762eb7eb456346ff062a45.png)

And “Auth” tab of each request as below to inherit Auth from parent (ie the collection the request is under)  
 ![image](https://global.discourse-cdn.com/sailpoint/original/2X/5/5983a49feab46c9c0b062df31a93f3ebaaeea3ad.png)

Once this is set up, every time you need a new JWT token, you can send the request created in Step 3 and it will automatically store the access\_token under environment variables and directly linked to your collection.

TIP: With this setup, you can create multiple environments for various tenants and easily switch between tenants from the selector on right top (“No Environment” under Step 1)

---

<div class="post-metadata">

**Author:** ![sushantkulkarni](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sushantkulkarni/32/35213_2.png) [@sushantkulkarni](https://developer.sailpoint.com/discuss/u/sushantkulkarni)\
**Post date:** [June 21, 2023, 7:23am UTC](https://developer.sailpoint.com/discuss/t/save-access-token-in-postman/12809/2 "2023-06-21T07:23:01Z")

</div>

Thanks for sharing this! @iamnithesh

There’s also something very similar in the official collection offered, which you can find here:  
[https://developer.sailpoint.com/idn/api/postman-collections/](https://developer.sailpoint.com/idn/api/postman-collections/)

Since it is maintained by SailPoint, all you need is to fork the collection and keep pulling updates as they come. The collection comes with its own pre-request script that helps you get an access token without having to grab it from the session every time. Plus, you don’t even have to worry about missing an API call and add to your collection manually, as every API would already be in your collection.

---

<div class="post-metadata">

**Author:** ![aditya\_pathak](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/aditya_pathak/32/2758_2.png) [@aditya\_pathak](https://developer.sailpoint.com/discuss/u/aditya_pathak)\
**Post date:** [June 22, 2023, 9:10am UTC](https://developer.sailpoint.com/discuss/t/save-access-token-in-postman/12809/3 "2023-06-22T09:10:08Z")

</div>

> [@iamnithesh](#):
>
> Once this is set up, every time you need a new JWT token, you can send the request created in Step 3 and it will automatically store the access\_token under environment variables and directly linked to your collection.

Just a suggestion here -  
Instead of doing this in Postman and using bearer token, you could have just setup oauth2.0 authorization using PAT and just click “generate new access token”
