Socket
Socket
Sign inDemoInstall

express-authorization-bearer

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    express-authorization-bearer

Bearer authorization token middleware for express.


Version published
Weekly downloads
9
increased by80%
Maintainers
1
Install size
3.10 kB
Created
Weekly downloads
 

Readme

Source

About

Bearer authorization token middleware for express.

NPM

Purpose?

This module will attempt to extract a bearer token from a request from this location:

  • The value from the header Authorization: Bearer <token>.

If a token is found, it will be stored on req.token. Otherwise, it will abort the request immediately by sending code 401.

const express = require('express');
const bearerAuthorization = require('express-authorization-bearer');
const app = express();
const router = express.Router();

router.get('/user/:id', bearerAuthorization, function (req, res) {
    res.send(`token ${req.token}`);
})

app.use('/', router);
app.listen(3000);

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Keywords

FAQs

Last updated on 30 Jan 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc