Gathering detailed insights and metrics for passport-http-bearer
Gathering detailed insights and metrics for passport-http-bearer
Gathering detailed insights and metrics for passport-http-bearer
Gathering detailed insights and metrics for passport-http-bearer
@types/passport-http-bearer
TypeScript definitions for passport-http-bearer
passport-http-custom-bearer
HTTP Bearer authentication strategy using custom headers and field names for Passport. Forked from https://github.com/jaredhanson/passport-http-bearer.
passport-http-bearer-sl
HTTP Bearer authentication strategy for Passport.
passport-keycloak-bearer
HTTP Bearer authentication strategy for Passport and Keycloak
HTTP Bearer authentication strategy for Passport and Node.js.
npm install passport-http-bearer
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
952 Stars
354 Commits
143 Forks
15 Watching
3 Branches
6 Contributors
Updated on 27 Nov 2024
JavaScript (91.41%)
Makefile (8.59%)
Cumulative downloads
Total Downloads
Last day
-4%
51,265
Compared to previous day
Last week
3.1%
284,468
Compared to previous week
Last month
21%
1,125,378
Compared to previous month
Last year
0.3%
10,981,438
Compared to previous year
1
3
HTTP Bearer authentication strategy for Passport.
This module lets you authenticate HTTP requests using bearer tokens, as specified by RFC 6750, in your Node.js applications. By plugging into Passport, bearer token support can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.
:hammer_and_wrench: API Reference • :heart: Sponsors
Advertisement
Node.js, Express, MongoDB & More: The Complete Bootcamp 2020
Master Node by building a real-world RESTful API and web app (with authentication, Node.js security, payments & more)
$ npm install passport-http-bearer
1$ npm install @types/passport-http-bearer
The HTTP Bearer authentication strategy authenticates users using a bearer
token. The strategy requires a verify
callback, which accepts that
credential and calls done
providing a user. Optional info
can be passed,
typically including associated scope, which will be set by Passport at
req.authInfo
to be used by later middleware for authorization and access
control.
1passport.use(new BearerStrategy(
2 function(token, done) {
3 User.findOne({ token: token }, function (err, user) {
4 if (err) { return done(err); }
5 if (!user) { return done(null, false); }
6 return done(null, user, { scope: 'all' });
7 });
8 }
9));
Use passport.authenticate()
, specifying the 'bearer'
strategy, to
authenticate requests. Requests containing bearer tokens do not require session
support, so the session
option can be set to false
.
For example, as route middleware in an Express application:
1app.get('/profile', 2 passport.authenticate('bearer', { session: false }), 3 function(req, res) { 4 res.json(req.user); 5 });
Bearer tokens are typically issued using OAuth 2.0. OAuth2orize is a toolkit for implementing OAuth 2.0 servers and issuing bearer tokens. Once issued, this module can be used to authenticate tokens as described above.
The HTTP Bearer authentication strategy authenticates requests based on a bearer token contained in the:
Authorization
header field where the value is in the format {scheme} {token}
and scheme is "Bearer" in this case.access_token
body parameteraccess_token
query parameterFor a complete, working example, refer to the Bearer example.
Copyright (c) 2011-2013 Jared Hanson <https://www.jaredhanson.me/>
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
8 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More