# Access auth information in pre-request script

**URL:** <https://community.postman.com/t/access-auth-information-in-pre-request-script/2799>\
**Category:** Help Hub\
**Tags:** scripts, authentication, oauth2\
**Created:** [September 26, 2018, 3:59pm UTC](https://community.postman.com/t/access-auth-information-in-pre-request-script/2799 "2018-09-26T15:59:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![trumpi](https://avatars.discourse-cdn.com/v4/letter/t/ba8739/32.png) [@trumpi](https://community.postman.com/u/trumpi)\
**Post date:** [September 26, 2018, 3:59pm UTC](https://community.postman.com/t/access-auth-information-in-pre-request-script/2799/1 "2018-09-26T15:59:33Z")

</div>

I am trying to write a pre-request script that generates an app secret proof for a Facebook API. I am using the new authentication feature in Postman, but I was wondering whether it is possible to access the token and the app secret in the script. My script is below, with some comments to clarify what I mean:

```auto
var access_token = "redacted lol"; // Can I get this from the collection's authorization?
var app_secret = pm.globals.get("appSecret"); // Can I get this from the collection's authorization?
pm.globals.set("appsecret_proof", CryptoJS.HmacSHA256(access_token, app_secret).toString(CryptoJS.enc.Hex));

```

---

<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 30, 2025, 2:55pm UTC](https://community.postman.com/t/access-auth-information-in-pre-request-script/2799/2 "2025-04-30T14:55:03Z")

</div>


