Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including zetta-peer-auth with all npm packages installed. Try it out:

var zettaPeerAuth = require("zetta-peer-auth")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

zetta-peer-auth v0.3.0

Add authorization to Zetta peer requests.

zetta-peer-auth

Add authorization to Zetta peer requests.

Note: This currently only supports the OAuth Client Credentials grant type.

Install

npm install zetta-peer-auth

Usage

var zetta = require('zetta');
var auth = require('zetta-peer-auth');

var options = {
  headers: {
    'Authorization': new Buffer('user:password').toString('base64'),
    'Content-Type': 'application/x-www-form-urlencoded'
  },
  url: 'https://<authorization_server>',
  method: 'POST',
  body: 'grant_type=client_credentials'
}; // request to receive an access token

zetta()
  .use(auth(options))
  .link('http://<resource_server>')
  .listen(3001)

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free