Bearer authentication middleware for fetch-plus. Version 3.10.4 provides a simple way to attach Bearer tokens to HTTP requests via fetch-plus's middleware system. It integrates with fetch-plus's composable pipeline, allowing token injection from a static string, a function returning a token, or an async function. The library is lightweight and focused, relying on fetch-plus ^3.0.1. Compared to other auth helpers, it leverages fetch-plus's middleware architecture for cleaner separation of concerns, but is tightly coupled to fetch-plus and not usable standalone.
npm install fetch-plus-bearerauthNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a fetch-plus client with bearer token authentication middleware.
Use fetch.create({ middleware: [bearerauth({...})] }) or client.use(bearerauth({...})).Use bearerauth({ token: () => getToken() }) to support token rotation.Use default import: import bearerauth from 'fetch-plus-bearerauth'
Only use bearerauth() within a middleware array passed to fetch-plus create() or use().