{"id":22394310,"url":"https://github.com/akamai/edgeauth-token-node","last_synced_at":"2025-12-28T03:24:50.751Z","repository":{"id":29553620,"uuid":"85525344","full_name":"akamai/EdgeAuth-Token-Node","owner":"akamai","description":"Akamai Authorization Token for Node","archived":false,"fork":false,"pushed_at":"2024-04-03T18:25:48.000Z","size":432,"stargazers_count":22,"open_issues_count":9,"forks_count":14,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-24T00:48:54.008Z","etag":null,"topics":["akamai","edgeauth","javascript","nodejs","property-manager","token"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akamai.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}},"created_at":"2017-03-20T02:06:40.000Z","updated_at":"2024-09-29T10:51:45.000Z","dependencies_parsed_at":"2024-06-18T22:53:16.131Z","dependency_job_id":"f74a3320-26c0-44a8-9e1a-078a62926f0a","html_url":"https://github.com/akamai/EdgeAuth-Token-Node","commit_stats":null,"previous_names":["astinchoi/akamai-edgeauth-node"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/akamai/EdgeAuth-Token-Node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akamai%2FEdgeAuth-Token-Node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akamai%2FEdgeAuth-Token-Node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akamai%2FEdgeAuth-Token-Node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akamai%2FEdgeAuth-Token-Node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akamai","download_url":"https://codeload.github.com/akamai/EdgeAuth-Token-Node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akamai%2FEdgeAuth-Token-Node/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268024612,"owners_count":24183149,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["akamai","edgeauth","javascript","nodejs","property-manager","token"],"created_at":"2024-12-05T05:09:41.661Z","updated_at":"2025-12-28T03:24:50.707Z","avatar_url":"https://github.com/akamai.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EdgeAuth-Token-Node: Akamai Edge Authorization Token for Node\n\n[![npm package](https://badge.fury.io/js/akamai-edgeauth.svg)](https://badge.fury.io/js/akamai-edgeauth)\n[![Build Status](https://travis-ci.org/akamai/EdgeAuth-Token-Node.svg?branch=master)](https://travis-ci.org/akamai/EdgeAuth-Token-Node)\n[![License](http://img.shields.io/:license-apache-blue.svg)](https://github.com/akamai/EdgeAuth-Token-Node/blob/master/LICENSE)\n\n[![npm package](https://nodei.co/npm/akamai-edgeauth.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/akamai-edgeauth/)\n\nEdgeAuth-Token-Node is Akamai Edge Authorization Token in the HTTP Cookie, Query String and Header for a client.\nYou can configure it in the Property Manager at https://control.akamai.com.\nIt's the behaviors which is Auth Token 2.0 Verification and Segmented Media Protection.\n\nEdgeAuth-Token-Node supports for Node.js 4.0+\n\n## Installation\n\nTo install Akamai Edge Authorization Token with npm:  \n\n```Shell\n$ npm install akamai-edgeauth --save\n```\n  \n\n## Example\n\n```Javascript\nconst EdgeAuth = require('akamai-edgeauth')\nconst http = require('http') // Module for the test\n\n\nvar EA_HOSTNAME = 'edgeauth.akamaized.net'\nvar EA_ENCRYPTION_KEY = 'YourEncryptionKey' \nvar DURATION = 500 // seconds\n\n\n// Function just for the simple test\nfunction makeRequest(options, callback) {\n    var request = http.request(options, (res) =\u003e {\n        callback(res)\n    })\n    request.on('error', (err) =\u003e {\n        callback(err)\n    })\n    request.end()\n}\n```\n* EA_ENCRYPTION_KEY must be hexadecimal digit string with even-length.  \n* Don't expose EA_ENCRYPTION_KEY on the public repository.  \n\n\n#### URL parameter option\n\n```Javascript\n// [EXAMPLE 1] Cookie\nvar ea = new EdgeAuth({\n    key: EA_ENCRYPTION_KEY,\n    windowSeconds: DURATION,\n    escapeEarly: true\n})\nvar token = ea.generateURLToken(\"/akamai/edgeauth\")\nvar options = {\n    hostname: EA_HOSTNAME,\n    path: '/akamai/edgeauth',\n    'Cookie': `${ea.options.tokenName}=${token}`\n}\nmakeRequest(options, function(res) {\n    console.log(res.statusCode) // If pass, it won't response 403 code.\n})\n\n// [EXAMPLE 2] Query string\ntoken = ea.generateURLToken(\"/akamai/edgeauth\")\noptions = {\n    hostname: EA_HOSTNAME,\n    path: `/akamai/edgeauth?${ea.options.tokenName}=${token}`\n}\nmakeRequest(options, function(res) {\n    console.log(res.statusCode)\n})\n```\n* 'Escape token input' option in the Property Manager corresponds to 'escapeEarly' in the code.  \nEscape token input (on) == escapeEarly (true)  \nEscape token input (off) == escapeEarly (false)  \n\n* In [Example 2] for Query String, it's only okay for 'Ignore query string' option (on).\n* If you want to 'Ignore query string' option (off) using query string as your token, Please contact your Akamai representative.  \n\n\n#### ACL(Access Control List) parameter option\n\n```Javascript\n// [EXAMPLE 1] Header using *\nvar ea = new EdgeAuth({\n    key: EA_ENCRYPTION_KEY,\n    windowSeconds: DURATION,\n    escapeEarly: false\n})\nvar token = ea.generateURLToken(\"/akamai/edgeauth/*\")\nvar options = {\n    hostname: EA_HOSTNAME,\n    path: \"/akamai/edgeauth/something\",\n    headers: {[ea.options.tokenName]: token}\n}\nmakeRequest(options, function(res) {\n    console.log(res.statusCode)\n})\n\n\n// [EXAMPLE 2] Cookie using ACL delimiter\nvar ea = new EdgeAuth({\n    key: EA_ENCRYPTION_KEY,\n    windowSeconds: DURATION,\n    escapeEarly: false\n})\nvar acl = [\"/akamai/edgeauth/??\", \"/akamai/edgeauth/list/*\"]\nvar token = ea.generateURLToken(acl)\nvar options = {\n    hostname: EA_HOSTNAME,\n    path: \"/akamai/edgeauth/22\",\n    Cookie: `${ea.options.tokenName}: ${token}`\n}\nmakeRequest(options, function(res) {\n    console.log(res.statusCode)\n})\n\n```\n* ACL can use the wildcard(\\*, ?) in the path.\n* Don't use '!' in your path because it's ACL Delimiter\n* Use 'escapeEarly=false' as default setting but it doesn't matter turning on/off 'Escape token input' option in the Property Manager\n\n\n## Usage\n\n#### EdgeAuth Class\n\n```Javascript\nclass EdgeAuth {\n    constructor(options) {}\n}\n```\n\n| Parameter | Description |\n|-----------|-------------|\n| options.tokenType | Select a preset. (Not Supported Yet) |\n| options.tokenName | Parameter name for the new token. [ Default: \\_\\_token\\_\\_ ] |\n| options.key | Secret required to generate the token. It must be hexadecimal digit string with even-length. |\n| options.algorithm  | Algorithm to use to generate the token. ('sha1', 'sha256', or 'md5') [ Default: 'sha256' ] |\n| options.salt | Additional data validated by the token but NOT included in the token body. (It will be deprecated) |\n| options.startTime | What is the start time? (Use string 'now' for the current time) |\n| options.endTime | When does this token expire? endTime overrides windowSeconds |\n| options.windowSeconds | How long is this token valid for? |\n| options.fieldDelimiter | Character used to delimit token body fields. [ Default: ~ ] |\n| options.aclDelimiter | Character used to delimit acl. [ Default: ! ] |\n| options.escapeEarly | Causes strings to be url encoded before being used. |\n| options.verbose | Print all parameters. |\n\n\n#### EdgeAuth's Method\n\n```Javascript\ngenerateURLToken(url) {}\ngenerateACLToken(acl) {}\n\n// both return the authorization token string.\n```\n\n| Parameter | Description |\n|-----------|-------------|\n| url | Single URL path (String) |\n| acl | Access Control List can use the wildcard(\\*, ?). It can be String (single path) or Array (multi paths) |\n\n\n## Others\n\nIf you use the **Segmented Media Protection** behavior in AMD(Adaptive Media Delivery) Product, **tokenName(options.tokenName)** should be '**hdnts**'.\n\n## Command\n\nYou can use the command with [cms-edgeauth.js](https://github.com/akamai/EdgeAuth-Token-Node/blob/master/cms-edgeauth.js) in your terminal with [commander](https://www.npmjs.com/package/commander) to generate the token.\n\n```Shell\n$ npm install commander --save\n$ node cms-edgeauth.js --key YourEncryptionKey --window 5000 --url /hello/world --escape_early\n```\n\nUse -h or --help option for the detail.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakamai%2Fedgeauth-token-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakamai%2Fedgeauth-token-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakamai%2Fedgeauth-token-node/lists"}