Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

edgegrid

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

edgegrid

Authorisation process and API helper for Akamai OPEN APIs

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5K
increased by96.84%
Maintainers
1
Weekly downloads
 
Created
Source

EdgeGrid for Node.js

This library implements an Authentication handler for requests that provides the Akamai {OPEN} Edgegrid Authentication scheme. For more infomation visit the Akamai {OPEN} Developer Community.

@jldb

Installation

npm install --save edgegrid

Reporting a bug

To report a bug simply create a new GitHub Issue and describe your problem or suggestion.

Before reporting a bug look around to see if there are any open or closed tickets that cover your issue. And remember the wisdom: pull request > bug report > tweet!

Contributing

To contribute please feel free to create a fork and submit a pull request.

Example

To use the AkamaiOPEN API you must first register the correct user credentials. You can do that through the LUNA control panel.

Basic use of the library looks like the following. This will prepare the auth header and then execute it. Remember that requests to the API are signed with a timestamp and therefore should be executed immediately.


	var EdgeGrid = require('edgegrid');

	var client_token = "akab-access-token-xxx-xxxxxxxxxxxxxxxx",
	  client_secret = "akab-client-token-xxx-xxxxxxxxxxxxxxxx",
	  access_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=",
	  base_uri = "https://akaa-baseurl-xxxxxxxxxxx-xxxxxxxxxxxxx.luna.akamaiapis.net/";

	var data = "datadatadatadatadatadatadatadata";

	var eg = new EdgeGrid(client_token, client_secret, access_token, base_uri);

	eg.auth({
	  "path": "billing-usage/v1/products",
	  "method": "POST",
	  "headers": {},
	  "body": data
	});

	eg.send(function (data, response) {
	  console.log(data);
	});

In addition passing the credentials manually as above, you may also authenticate using a .edgerc file, specifying its path and the group name (default is 'default'):

var eg = new EdgeGrid({
  path: '/path/to/.edgerc',
  group: 'mygroup'
});

An .edgerc file contains groups of credentials and is usually hosted in your home directory:

[default]
host = akaa-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.luna.akamaiapis.net/
client_token = akab-XXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXX
client_secret = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
access_token = akab-XXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXX
max-body = 131072

[mygroup]
host = akaa-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.luna.akamaiapis.net/
client_token = akab-XXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXX
client_secret = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
access_token = akab-XXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXX
max-body = 131072

Calls using the edgegrid client can also be chained as per the following;

	...

	eg.auth({
	  "path": "billing-usage/v1/products",
	  "method": "POST",
	  "headers": {},
	  "body": data
	}).send(function (data, response) {
	  console.log(data);
	});

Headers for the request must be supplied as an object as name : value pairs. You do not need to supply form-data headers or content lengths - that will cause authentication headers on the API.

The request BODY can be provided as either an object or as an already POST data formed string.

Contributors

Thanks to people who have contributed to this.

Keywords

FAQs

Package last updated on 01 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc