{"library":"fetch-mw-oauth2","type":"library","category":null,"description":"fetch-mw-oauth2 is a JavaScript library designed to simplify OAuth2 integration with the standard `fetch` API, handling automatic token acquisition and refreshing. Currently at v3.3.1, it supports `authorization_code`, `password`, and `client_credentials` grant types, offers robust error handling, OpenID Connect `id_token` exposure, and includes support for token revocation (RFC 7009) and the `resource` parameter (RFC 8707). Since its v3.0.0 release, the library is ESM-only and has ceased support for Node.js 14 and 16. It primarily functions as a `fetch` wrapper or middleware. This package is in maintenance mode, as development has shifted to its successor, `@badgateway/oauth2-client`, which offers enhanced features and similar functionality.","language":"javascript","status":"maintenance","version":"1.0.2","tags":["javascript","fetch","oauth2","typescript"],"last_verified":"Wed May 27","install":[{"cmd":"npm install fetch-mw-oauth2","imports":["import { OAuth2 } from 'fetch-mw-oauth2'","import type { OAuth2Options, OAuth2Token } from 'fetch-mw-oauth2'","import { OAuth2 } from 'fetch-mw-oauth2';\n\nconst oauth2 = new OAuth2({\n  clientId: 'your-client-id',\n  clientSecret: process.env.OAUTH_CLIENT_SECRET ?? '', // Optional in some cases\n  tokenEndpoint: 'https://auth.example.org/token',\n}, {\n  accessToken: 'initial-access-token',\n  refreshToken: 'initial-refresh-token',\n});\n\nconst response = await oauth2.fetch('https://api.example.org/data');"]},{"cmd":"yarn add fetch-mw-oauth2","imports":[]},{"cmd":"pnpm add fetch-mw-oauth2","imports":[]}],"homepage":null,"github":"https://github.com/badgateway/fetch-mw-oauth2","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/fetch-mw-oauth2","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/fetch-mw-oauth2/compatibility"}}