
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
bearer-token
Advanced tools
Callback with a rfc6750 OAuth 2.0 Bearer Token from an http request object, ready for verification.
npm install bearer-token
var bearerToken = require('bearer-token')
var http = require('http')
server = http.createServer()
server.listen(8000, function () {
console.log('server started on 8000')
})
server.on('request', function(req ,res) {
bearerToken(req, function(err, token) {
// Now you have to verify the token
})
})
Pass in a standard http reuest object to extract a single bearer token from the request in the callback, if it exists. If no bearer token is found, token will be undefined. The first bearer token that is found is returned. Authentication headers take precidence over tokens found in the body.
var bearerToken = require('bearer-token')bearerToken is a single asyncronous function.
bearerToken(req, callback)req Accepts a standard http request object. The request header and body are parsed in search of a bearer token. Tokens found in the request header take precidence over tokens in the body.callback(error, token) Function is called with any errors and a token if found. A missing token is not grounds for an error (only parsing or unexpected errors).
error Error object if anything bad happened.token String if a token is found. You still need to verify it.Contributions welcome! Please read the contributing guidelines first.
| bcomnes | GitHub/bcomnes |
|---|---|
| wpacks | GitHub/wpacks |
FAQs
Returns rfc6750 OAuth Bearer Token from an http request object
The npm package bearer-token receives a total of 12 weekly downloads. As such, bearer-token popularity was classified as not popular.
We found that bearer-token demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.