Notable Peru Mariachis

    verify-jwt

    1.0.9 • Public • Published

    verify-jwt

    verify-jwt is a middleware used to protect the route handlers from from fake requests

    Getting Started

    install #verify-jwt through npm install and use in the routes as middleware as simple as that

    While requesting send the token through

    queryparams with field name token

    http://www.google.com/api?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ
    

    or headers with field name x-access-token

    x-access-token : eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ
    

    verify-jwt automatically authunticates the token if error it will send valid error response else if success the token payload will be available in the req.user object

    Installing

    A step by step series of examples that tell you how to get a development env running

    npm install verify-jwt
    
    const vj = require('verify-jwt');
     
    app.get('/auth', vj.protect('secret'),(req,res)=>{
        // you can get token payload with req.user object
        let payload = req.user;
    })
     

    Authors

    • Vamsi Aila

    License

    This project is licensed under the MIT License

    Install

    npm i verify-jwt

    DownloadsWeekly Downloads

    8

    Version

    1.0.9

    License

    MIT

    Unpacked Size

    2.59 kB

    Total Files

    3

    Last publish

    Collaborators

    • vamsiaila