{"_id":"@dorbash2/akamai-edgegrid","_rev":"4-9cabd41150c6aa310478a5b35b2fc5d5","name":"@dorbash2/akamai-edgegrid","dist-tags":{"latest":"3.5.5"},"versions":{"3.5.4":{"name":"@dorbash2/akamai-edgegrid","version":"3.5.4","keywords":["akamai","open","api","edgegrid"],"author":"","license":"Apache-2.0","_id":"@dorbash2/akamai-edgegrid@3.5.4","maintainers":[{"name":"dorbash2","email":"dor@veriti.ai"}],"homepage":"https://github.com/Dorbash/akamai-edgegrid#readme","bugs":{"url":"https://github.com/Dorbash/akamai-edgegrid/issues"},"dist":{"shasum":"c7ae3ab13fa591e554e53299bce4019a3fea43bd","tarball":"https://registry.npmjs.org/@dorbash2/akamai-edgegrid/-/akamai-edgegrid-3.5.4.tgz","fileCount":29,"integrity":"sha512-j8nEGg5Hposs/9FEC/4aUDmesdOVavVtkU8+ka2OQLRITxuWAwiKjun/YIRSz06Kit7tqOBAfS8XF+LUzhOIHw==","signatures":[{"sig":"MEUCIQDns+BesCZ07xHsDCtf12XKgtpQme5ZnC1hWUmwoDApcAIgTbWdFoXxnFPluInhKkSKENo/G9ZaHEzJE5eyD15BogM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":340823},"main":"index.js","type":"commonjs","types":"./index.d.ts","gitHead":"b7f6c75456a3b1297d6cfaefff7306684a07a9e1","scripts":{"ci":"EDGEGRID_ENV=test MOCHA_FILE=./test/tests.xml nyc --reporter cobertura --report-dir test/coverage/ ./node_modules/.bin/mocha --reporter mocha-junit-reporter --reporter-options jenkinsMode=true --reporter-options antMode=true $(find test -name '*.js')","test":"EDGEGRID_ENV=test ./node_modules/.bin/mocha $(find test -name '*.js')"},"_npmUser":{"name":"dorbash2","email":"dor@veriti.ai"},"repository":{"url":"git+https://github.com/Dorbash/AkamaiOPEN-edgegrid-node.git","type":"git"},"_npmVersion":"11.3.0","description":"Authentication handler for the Akamai OPEN EdgeGrid Authentication scheme in Node.js","directories":{"test":"test","example":"examples"},"_nodeVersion":"24.2.0","dependencies":{"uuid":"^10.0.0","axios":"^1.1.2","log4js":"^6.4.0"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^17.0.0","tsd":"^0.31.0","nock":"^13.2.2","mocha":"^11.0.1","mocha-junit-reporter":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/akamai-edgegrid_3.5.4_1752499822243_0.6898405977717683","host":"s3://npm-registry-packages-npm-production"}},"3.5.5":{"name":"@dorbash2/akamai-edgegrid","version":"3.5.5","description":"Authentication handler for the Akamai OPEN EdgeGrid Authentication scheme in Node.js","main":"index.js","scripts":{"test":"EDGEGRID_ENV=test ./node_modules/.bin/mocha $(find test -name '*.js')","ci":"EDGEGRID_ENV=test MOCHA_FILE=./test/tests.xml nyc --reporter cobertura --report-dir test/coverage/ ./node_modules/.bin/mocha --reporter mocha-junit-reporter --reporter-options jenkinsMode=true --reporter-options antMode=true $(find test -name '*.js')"},"repository":{"type":"git","url":"git+https://github.com/Dorbash/AkamaiOPEN-edgegrid-node.git"},"keywords":["akamai","open","api","edgegrid"],"license":"Apache-2.0","dependencies":{"axios":"^1.1.2","log4js":"^6.4.0","uuid":"^10.0.0"},"devDependencies":{"mocha":"^11.0.1","mocha-junit-reporter":"^2.1.0","nock":"^13.2.2","nyc":"^17.0.0","tsd":"^0.31.0"},"directories":{"example":"examples","test":"test"},"author":"","type":"commonjs","types":"./index.d.ts","bugs":{"url":"https://github.com/Dorbash/akamai-edgegrid/issues"},"homepage":"https://github.com/Dorbash/akamai-edgegrid#readme","_id":"@dorbash2/akamai-edgegrid@3.5.5","gitHead":"6c756d64997908b69e0d35c65b61dd8e2be0c0e6","_nodeVersion":"24.2.0","_npmVersion":"11.3.0","dist":{"integrity":"sha512-y7j3/ZHQcp2fNusGcZy8rL9Xt3HCAfIQnr3i6QnwZ0tnXaKp2Q0Rvb7yvpvwiCRmDbr2MP+mudOsgi23CflDUg==","shasum":"da15797a759837e5ff1396ac11d72e93581d19ab","tarball":"https://registry.npmjs.org/@dorbash2/akamai-edgegrid/-/akamai-edgegrid-3.5.5.tgz","fileCount":29,"unpackedSize":340884,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD/OoJhz7+/8PUwmMQa0nYYuqapzgFFmaNUQm4fhxOgkQIgOH4UjKCfGhjqJzgkj00yWt8Di2X9usUKAUuwJ597TT8="}]},"_npmUser":{"name":"dorbash2","email":"dor@veriti.ai"},"maintainers":[{"name":"dorbash2","email":"dor@veriti.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/akamai-edgegrid_3.5.5_1752500751925_0.4135079416141374"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-14T13:30:22.139Z","modified":"2025-07-14T13:45:52.307Z","3.5.3":"2025-07-14T13:25:41.829Z","3.5.4":"2025-07-14T13:30:22.427Z","3.5.5":"2025-07-14T13:45:52.107Z"},"bugs":{"url":"https://github.com/Dorbash/akamai-edgegrid/issues"},"license":"Apache-2.0","homepage":"https://github.com/Dorbash/akamai-edgegrid#readme","keywords":["akamai","open","api","edgegrid"],"repository":{"type":"git","url":"git+https://github.com/Dorbash/AkamaiOPEN-edgegrid-node.git"},"description":"Authentication handler for the Akamai OPEN EdgeGrid Authentication scheme in Node.js","maintainers":[{"name":"dorbash2","email":"dor@veriti.ai"}],"readme":"# EdgeGrid for Node.js\n\n![Build Status](https://github.com/akamai/AkamaiOPEN-edgegrid-node/actions/workflows/test.yml/badge.svg)\n\nThis library implements an Authentication handler for the Akamai EdgeGrid Authentication scheme in Node.js for Node v14 and above.\n\nYou can find the most up-to-date package in [NPM](https://www.npmjs.com/package/akamai-edgegrid) under `akamai-edgegrid`.\n\n## Install\n\n`npm install --save akamai-edgegrid`\n\n## Authentication\n\nYou can obtain the authentication credentials through an API client. Requests to the API are marked with a timestamp and a signature and are executed immediately.\n\n1. [Create authentication credentials](https://techdocs.akamai.com/developer/docs/set-up-authentication-credentials).\n\n2. Place your credentials in an EdgeGrid file `~/.edgerc`, in the `[default]` section.\n\n    ```\n    [default]\n    client_secret = C113nt53KR3TN6N90yVuAgICxIRwsObLi0E67/N8eRN=\n    host = akab-h05tnam3wl42son7nktnlnnx-kbob3i3v.luna.akamaiapis.net\n    access_token = akab-acc35t0k3nodujqunph3w7hzp7-gtm6ij\n    client_token = akab-c113ntt0k3n4qtari252bfxxbsl-yvsdj\n    ```\n\n3. Use your local `.edgerc` by providing the path to your resource file and credentials' section header.\n\n    ```javascript\n    var eg = new EdgeGrid({\n      path: '/path/to/.edgerc',\n      section: '<section-header>'\n    });\n    ```\n\n    Alternatively, you can hard code your credentials by passing the credential values to the `EdgeGrid()` method.\n\n    ```javascript\n    var clientToken = \"akab-c113ntt0k3n4qtari252bfxxbsl-yvsdj\",\n        clientSecret = \"C113nt53KR3TN6N90yVuAgICxIRwsObLi0E67/N8eRN=\",\n        accessToken = \"akab-acc35t0k3nodujqunph3w7hzp7-gtm6ij\",\n        baseUri = \"akab-h05tnam3wl42son7nktnlnnx-kbob3i3v.luna.akamaiapis.net\";\n\n    var eg = new EdgeGrid(clientToken, clientSecret, accessToken, baseUri);\n    ```\n\n## Use\n\nTo use the library, provide the path to your `.edgerc`, your credentials section header, and the appropriate endpoint information.\n\n```javascript\nvar EdgeGrid = require('akamai-edgegrid');\n\nvar eg = new EdgeGrid({\n  path: '/path/to/.edgerc',\n  section: 'section-header'\n});\n\neg.auth({\n  path: '/identity-management/v3/user-profile',\n  method: 'GET',\n  headers: {\n    'Accept': \"application/json\"\n  },\n  body: {}\n});\n\neg.send(function(error, response, body) {\n  console.log(body);\n});\n```\n\n### Chaining\n\nYou can also chain calls by combining the execution of `auth` and `send` methods.\n\n```javascript\neg.auth({\n  path: '/identity-management/v3/user-profile',\n  method: 'GET',\n  headers: {},\n  body: {}\n}).send(function (error, response, body) {\n  console.log(body);\n});\n```\n\n### Query string parameters\n\nWhen entering query parameters use the `qs` property under the `auth` method. Set up the parameters as name-value pairs in a object.\n\n```javascript\neg.auth({\n    path: '/identity-management/v3/user-profile',\n    method: 'GET',\n    headers: {},\n    qs: {\n        authGrants: true,\n        notifications: true,\n        actions: true\n    },\n    body: {}\n})\n```\n\n### Headers\n\nEnter request headers as name-value pairs in an object.\n\n> **Note:** You don't need to include the `Content-Type` and `Content-Length` headers. The authentication layer adds these values.\n\n```javascript\neg.auth({\n  path: '/identity-management/v3/user-profile',\n  method: 'GET',\n  headers: {\n    'Accept': \"application/json\"\n  }\n});\n```\n\n### Body data\n\nProvide the request body as an object or as a POST data formatted string.\n\n```javascript\n// Object\neg.auth({\n    path: '/identity-management/v3/user-profile/basic-info',\n    method: 'PUT',\n    headers: {},\n    body: {\n        contactType: \"Billing\",\n        country: \"USA\",\n        firstName: \"John\",\n        lastName: \"Smith\",\n        phone: \"3456788765\",\n        preferredLanguage: \"English\",\n        sessionTimeOut: 30,\n        timeZone: \"GMT\"\n   }\n});\n```\n\n### Encoding\n\nWhen interacting with binary data, such as during the retrieval of PDF invoices, specify the `responseType` as an `arraybuffer` in the `auth` method call. Omitting the `responseType` will cause an unreadable or blank response.\n\n```javascript\nconst fs = require('fs');\n\neg.auth({\n  path : `/invoicing-api/v2/contracts/${contractId}/invoices/${invoiceNumber}/files/${fileName}`,\n  method: 'GET',\n  responseType: 'arraybuffer', // Important\n}).send((err, response) => {\n  if (err) {\n    return console.log(err);\n  }\n  fs.writeFile(`./${fileName}`, response.data, 'binary', (err) => {\n    if (err){\n      return console.log(err);\n    }\n    console.log('File was saved!');\n  });\n});\n```\n\n### Proxy\n\nTo use edgegrid with proxy, you can configure it with one of these methods:\n\n- Add the `proxy` argument to the `EdgeGrid()` method.\n\n  ```javascript\n  eg.auth({\n    path : `/identity-management/v3/user-profile`,\n    method: 'GET',\n    proxy: {\n      host: 'my.proxy.com',\n      protocol: \"https\",\n      port: 3128,\n      auth: {\n        username: 'my-user',\n        password: 'my-password'\n      }\n    }\n  }).send((err, response) => {\n    if (err) {\n      return console.log(err);\n    }\n    console.log('Success!');\n    // Do something with the response\n  });\n  ```\n\n- Set the `HTTPS_PROXY` environment variable.\n\n  ```shell\n  $ export HTTPS_PROXY=https://username:password@host:port\n  $ node myapp.js\n  ```\n\n### Debug\n\nEnable debugging to get additional information about a request. You can configure this with one of these methods:\n\n- Add the `debug` argument to the `EdgeGrid()` method.\n\n  ```javascript\n  var eg = new EdgeGrid({\n    path: '/path/to/.edgerc',\n    section: 'section-header'\n    debug: true\n  });\n  ```\n\n- Set the `EG_VERBOSE` environment variable.\n\n  ```shell\n  $ export EG_VERBOSE=true\n  $ node src/main.js\n  ```\n\n### Custom Axios Instance\n\nYou can inject a custom axios instance to use instead of the default one. This allows you to configure custom timeouts, interceptors, or other axios-specific features.\n\n#### Using string parameters:\n\n```javascript\nconst axios = require('axios');\n\n// Create a custom axios instance\nconst customAxios = axios.create({\n    timeout: 30000, // 30 second timeout\n    headers: {\n        'User-Agent': 'MyCustomApp/1.0'\n    }\n});\n\n// Add custom interceptors\ncustomAxios.interceptors.request.use(config => {\n    console.log('Making request to:', config.url);\n    return config;\n});\n\n// Use with EdgeGrid\nvar eg = new EdgeGrid(\n    'your-client-token',\n    'your-client-secret', \n    'your-access-token',\n    'your-host.luna.akamaiapis.net',\n    false, // debug\n    undefined, // max_body\n    customAxios // custom axios instance\n);\n```\n\n#### Using object configuration:\n\n```javascript\nvar eg = new EdgeGrid({\n    path: '/path/to/.edgerc',\n    section: 'section-header',\n    axiosInstance: customAxios\n});\n```\n\nIf no custom axios instance is provided, the library will use the default axios instance.\n\n\n\n## Reporting issues\n\nTo report an issue or make a suggestion, create a new [GitHub issue](https://github.com/akamai/AkamaiOPEN-edgegrid-node/issues).\n\n## License\n\nCopyright 2025 Akamai Technologies, Inc. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use these files except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.","readmeFilename":"README.md"}