A lightweight plugin for Superagent that adds a convenient `.authBearer()` method for OAuth2 Bearer Token authentication. Version 0.0.1, released in 2014, is a minimal wrapper that monkey-patches the Superagent prototype. It is not actively maintained and lacks TypeScript types, ESM support, or modern security features. Compared to alternatives like `superagent-oauth`, this plugin focuses solely on Bearer tokens without extra OAuth2 flows. It requires Superagent as a peer dependency and modifies the global request object.
npm install superagent-auth-bearerVerified import paths — ran on the pinned version, not inferred.
Shows how to install the plugin, call it with superagent, and use the authBearer method to make an authenticated GET request.
Consider using native superagent .set('Authorization', 'Bearer token') or migrate to a modern HTTP library like axios or node-fetch.Ensure only one version of superagent is used; use npm's shrinkwrap or lockfile.
Manually validate the token before passing to .authBearer().
Test with superagent v2; for v3+ use manual Authorization header.
Make sure to run require('superagent-auth-bearer')(request) before using .authBearer().Run npm install superagent-auth-bearer --save (or --save-dev).
Use dynamic import or create a CommonJS compatibility layer. For example: const bearer = (await import('superagent-auth-bearer')).default;No dependency data recorded yet.