jwtextract

1.0.2 • Public • Published

jwtextract

fast extract your jwt from your authorization header

Usage

  1. Install with

    $ npm i jwtextract

    or

    $ yarn add jwtextract

HOW TO :

import jwtextract from 'jwtextract'
export const authenticateUser = async (req, res, next) => {
 
  // sent in the req and expect to get string jwt as return value
  const accessToken = jwtextract(req)
 
  if (!accessToken) {
     // response with some error
     return responseWithError(res, error(FORBIDDEN_MSG, FORBIDDEN))
  }
  else{
    // do your magic code...
  }
}

Package Sidebar

Install

npm i jwtextract

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

2.68 kB

Total Files

4

Last publish

Collaborators

  • natysoz