# Accessing Collection Authorization details from pre-request script

**URL:** <https://community.postman.com/t/accessing-collection-authorization-details-from-pre-request-script/48702>\
**Category:** Help Hub\
**Created:** [June 19, 2023, 4:53pm UTC](https://community.postman.com/t/accessing-collection-authorization-details-from-pre-request-script/48702 "2023-06-19T16:53:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joint-operations-ge7](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@joint-operations-ge7](https://community.postman.com/u/joint-operations-ge7)\
**Post date:** [June 19, 2023, 4:53pm UTC](https://community.postman.com/t/accessing-collection-authorization-details-from-pre-request-script/48702/1 "2023-06-19T16:53:09Z")

</div>

**My question** :  
How can I access a Collection’s Authorization details from the Collection’s Pre-request Script?

**Details** :  
Specifically, in my collection I have defined OAuth 2.0 with a Bearer token in the collection’s Authorization tab. I’d like to set an environment variable based on a claim in the JWT in a Pre-request Script, but this doesn’t seem possible.

**I’ve already tried** :  
In the Collection’s Pre-Request Script I’ve tried the following:

1. Calling `pm.request.getHeaders()` returns an empty object. I thought if I had access to the request headers, I could read the Authorization header and get access to the token that way, but the headers are empty at that point.
2. Calling `pm.request.auth` returns undefined. I thought that might have given me access to the oauth2 bearer token but since it returns undefined that doesn’t help.

This seems like it should be a fairly common use case. Any help would be appreciated. Thanks!
