# Accessing AWT Signature authentication via pm.sendRequest

**URL:** <https://community.postman.com/t/accessing-awt-signature-authentication-via-pm-sendrequest/63944>\
**Category:** Help Hub\
**Tags:** authentication\
**Created:** [July 10, 2024, 8:30pm UTC](https://community.postman.com/t/accessing-awt-signature-authentication-via-pm-sendrequest/63944 "2024-07-10T20:30:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![navigation-particip2](https://avatars.discourse-cdn.com/v4/letter/n/8e7dd6/32.png) [@navigation-particip2](https://community.postman.com/u/navigation-particip2)\
**Post date:** [July 10, 2024, 8:30pm UTC](https://community.postman.com/t/accessing-awt-signature-authentication-via-pm-sendrequest/63944/1 "2024-07-10T20:30:17Z")

</div>

Postman supports AWS authentication when making http calls via the auth tab. Is there anyway to access this authentication method via pm.sendRequest?

I have found references to being able to use basic and digest authentication via pm.sendRequest by declaring an ‘auth’ parameter in the options object. Something similar to the following:

```auto
{
  url: host + path,
  method: 'POST',
  auth: {
    type: "basic",
    basic: {
      username: 'BASIC_USER',
      password: 'BASIC_PASS'
    }     
  }}

```

I have found a [similar question](https://community.postman.com/t/aws-signatures-with-pm-sendrequest/15338) posted in 2020, however the following [post](https://learning.postman.com/docs/sending-requests/authorization/aws-signature/) from 2023 makes me think that the AWS Signature support might have been added to postman later than that question and I am hoping that it has also been exposed to the sendRequest method.

Assuming that pm.sendRequest does now support AWS, what are the runes required to access it. I am expecting something like the following but I keep getting ‘handler not found’ errors.

```auto

auth: {
type: "aws",
"aws": {
"AccessKey": "",
"SecretKey": "",
"AWS Region": "eu-central-1",
"Service Name": "ssm",
"Session Token":""
}

```

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [July 11, 2024, 12:20pm UTC](https://community.postman.com/t/accessing-awt-signature-authentication-via-pm-sendrequest/63944/2 "2024-07-11T12:20:08Z")

</div>

When you use the auth tab, this will send a request that you can view in the console logs.

Check this request to see how the headers and body are created which you can then replicate using sendRequest().

---

<div class="post-metadata">

**Author:** ![navigation-particip2](https://avatars.discourse-cdn.com/v4/letter/n/8e7dd6/32.png) [@navigation-particip2](https://community.postman.com/u/navigation-particip2)\
**Post date:** [July 11, 2024, 12:30pm UTC](https://community.postman.com/t/accessing-awt-signature-authentication-via-pm-sendrequest/63944/3 "2024-07-11T12:30:54Z")

</div>

> [@michaelderekjones](#):
>
> Check this request to see how the headers and body are created which you can then replicate using sendRequest().

Hi Mike, and thank you. The headers that have to be generated are hmac encodings of some secrets and the http request itself after some preprocessing to make the encoding repeatable. Information on the AWS encoding is well documented [here](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#UsingTemporarySecurityCredentials). It is not straight forward to replicate in the postman environment and I would prefer to use the AWS Signature support within postman, if it has been exposed to sendRequest. I am hoping that it has. If not then it would be great if it was.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [July 11, 2024, 1:10pm UTC](https://community.postman.com/t/accessing-awt-signature-authentication-via-pm-sendrequest/63944/4 "2024-07-11T13:10:07Z")

</div>

The authorization helpers do a lot of stuff in the background, and I don’t think its replicated for sendRequest().

Hopefully someone from Postman will be able to provide more information.

---

<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:** [July 11, 2024, 1:38pm UTC](https://community.postman.com/t/accessing-awt-signature-authentication-via-pm-sendrequest/63944/5 "2024-07-11T13:38:08Z")

</div>

You wouldn’t be able to achieve this with `pm.sendRequest()`, as Mike mentioned, the auth helpers are doing a whole bunch of things in the background to make this easier.

Some auth methods can be created with `pm.sendRequest()` but I don’t believe that this would be one of those.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [July 12, 2024, 12:18pm UTC](https://community.postman.com/t/accessing-awt-signature-authentication-via-pm-sendrequest/63944/6 "2024-07-12T12:18:33Z")

</div>

I just found the JavaScript code for this function in Postman.

[postman-runtime/lib/authorizer/aws4.js at develop · postmanlabs/postman-runtime · GitHub](https://github.com/postmanlabs/postman-runtime/blob/develop/lib/authorizer/aws4.js)

Just so we can see how complicated it is. You could in theory replicate that as a pre-request script but I wouldn’t want that task 🙂

---

<div class="post-metadata">

**Author:** ![navigation-particip2](https://avatars.discourse-cdn.com/v4/letter/n/8e7dd6/32.png) [@navigation-particip2](https://community.postman.com/u/navigation-particip2)\
**Post date:** [July 15, 2024, 7:56am UTC](https://community.postman.com/t/accessing-awt-signature-authentication-via-pm-sendrequest/63944/7 "2024-07-15T07:56:21Z")

</div>

You superstar Mike, that reference to the code was exactly the lead that I needed. From there I was able to find the registration of the security handlers within postman and I found that pm.sendRequest is wired up there. The following are the runes that I needed and I share incase anybody else ever requires them:

```auto
pm.sendRequest({
    url: "https://ssm.eu-central-1.amazonaws.com",
    method: "POST",
    header: {
        'Content-Type': 'application/x-amz-json-1.1',
        'X-Amz-Target': 'AmazonSSM.GetParameter'
    },
    auth: {
        type: "awsv4",
        "awsv4": {
            "accessKey": "$ACCESSKEY",
            "secretKey": "$SECRET",
            "region": "eu-central-1",
            "service": "ssm",
            "sessionToken": "$SESSION_TOKEN"
        }
    },
    body: .....
}, function (err, response) {
    ....
});

```

Happy days, I am so pleased that it is working. Thank you for your help everybody.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [July 18, 2024, 7:57am UTC](https://community.postman.com/t/accessing-awt-signature-authentication-via-pm-sendrequest/63944/8 "2024-07-18T07:57:11Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
