{"id":15679202,"url":"https://github.com/peter-evans/postman-pre-request","last_synced_at":"2025-07-05T18:33:12.608Z","repository":{"id":77843093,"uuid":"76613131","full_name":"peter-evans/postman-pre-request","owner":"peter-evans","description":"Postman Pre-request script for HMAC Authentication with Kong","archived":false,"fork":false,"pushed_at":"2019-02-08T03:20:02.000Z","size":54,"stargazers_count":12,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-07T09:36:32.786Z","etag":null,"topics":["hmac","hmac-authentication","javascript","kong","postman"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peter-evans.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"peter-evans"}},"created_at":"2016-12-16T02:13:54.000Z","updated_at":"2024-02-02T10:55:03.000Z","dependencies_parsed_at":"2023-04-27T19:04:04.927Z","dependency_job_id":null,"html_url":"https://github.com/peter-evans/postman-pre-request","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/peter-evans/postman-pre-request","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fpostman-pre-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fpostman-pre-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fpostman-pre-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fpostman-pre-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peter-evans","download_url":"https://codeload.github.com/peter-evans/postman-pre-request/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fpostman-pre-request/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263784861,"owners_count":23510987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hmac","hmac-authentication","javascript","kong","postman"],"created_at":"2024-10-03T16:26:43.057Z","updated_at":"2025-07-05T18:33:12.591Z","avatar_url":"https://github.com/peter-evans.png","language":"JavaScript","funding_links":["https://github.com/sponsors/peter-evans"],"categories":[],"sub_categories":[],"readme":"# Postman Pre-request script for HMAC Authentication with Kong\nThis is javascript for use with [Postman](https://www.getpostman.com/)'s pre-request script feature.\nIt generates HTTP request headers for HMAC authentication with [Kong](https://getkong.org/).\nMore specifically, Kong's [HMAC Authentication Plugin](https://docs.konghq.com/hub/kong-inc/hmac-auth/).\n\nThe script could easily be modified for use with custom HMAC authentication schemes.\n\n## Usage\n\n1. Copy the contents of [postman-pre-request-script.js](postman-pre-request-script.js) into the \"Pre-request Script\" tab in Postman.\n2. Create an environment and add two key-value pairs at Postman's \"Manage Environments\" settings dialog. `keyId` containing the ID or username of the API consumer, and `secret` containing the shared secret key.\n\n    ![Manage Environments](/screenshots/postman-manage-env.png?raw=true)\n3. Switch to the new environment.\n4. On the \"Headers\" tab click \"Bulk Edit\" and paste the following content into the headers field. Note that the `Content-Type` header must be set manually to the content type of your request. The other headers will be generated automatically by the script.\n\n        Authorization:{{auth-header}}\n        Date:{{date-header}}\n        Content-MD5:{{content-md5}}\n        Content-Length:{{content-length}}\n        Content-Type:application/json \n    As shown below:\n    ![Headers](/screenshots/postman-headers.png?raw=true)\n5. Send the request. \n\n## Modifying Signature Headers\nIf you don't require all five headers to be included in the signature hash you can comment out the headers you don't want in the javascript as shown below:\n```javascript\nvar sigHeaders = {\n    'request-line' : requestLine,\n    'date' : dateHeader,\n    //'content-type' : contentType,\n    'content-md5' : base64md5,\n    'content-length' : contentLength\n    };\n```  \n\n## Debugging the Script\n\nWhen making modifications to the script it is helpful to check the contents of the generated environment variables. You can do this by clicking on the eye icon next to the environment management button after sending a request.\n\n![Headers](/screenshots/postman-env-vars.png?raw=true)\n\n## Reference\n\n[HTTP Signatures Specification](https://tools.ietf.org/html/draft-cavage-http-signatures-00)\n\n## License\n\nMIT License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-evans%2Fpostman-pre-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeter-evans%2Fpostman-pre-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-evans%2Fpostman-pre-request/lists"}