Neurotic Pumpkin Murderer

simple-bearer-token

0.0.2 • Public • Published

simple-bearer-token

A module that creates and returns a token object from a bearer token string.

Build Status Coverage Status

Installation

npm i --save simple-bearer-token

How to use

const Token = require('simple-bearer-token');
 
const bearerTokenString = 'Get the token from your request, (or from anywhere)';
const options = {
  'secretOrPublicKey': 'shhhh',
};
const token = new Token(bearerTokenString, options); 

If the token is valid, it will return the object. Otherwise, it will throw an error.

Options

Option Description
secretOrPublicKey a string or buffer containing either the secret for HMAC algorithms, or the PEM encoded public key for RSA and ECDSA

Any option of the verify method of the jsonwebtoken module:

  • algorithms
  • audience
  • issuer
  • ignoreExpiration
  • subject
  • clockTolerance
  • maxAge
  • clockTimestamp

Such options will be used to verify the token.

License and Credits

MIT License. Copyright 2017

Built by the Node.JS experts at Devsu.

install

npm i simple-bearer-token

Downloadsweekly downloads

3

version

0.0.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability