Skip to main content

OAuth 2 / OpenID Connect Client for Web APIs runtime

This is a collection of bits and pieces upon which a more streamlined Client module may be written.

In Scope & Implemented

  • Authorization Server Metadata discovery
  • OpenID Connect 1.0 and OAuth 2.0 Authorization Code Flow
  • PKCE
  • Refresh Token Grant
  • Device Authorization Grant
  • Client Credentials Grant
  • Demonstrating Proof-of-Possession at the Application Layer (DPoP)
  • Token Introspection
  • JWT Token Introspection
  • Token Revocation
  • JWT Secured Authorization Response Mode (JARM)
  • Confidential and Public Client
  • JWT-Secured Authorization Request (JAR)
  • Pushed Authorization Requests (PAR)
  • UserInfo Requests (Bearer and DPoP)
  • JWT UserInfo Responses
  • Protected Resource Requests (Bearer and DPoP)
  • Authorization Server Issuer Identification

Dependencies: 0

Documentation

Examples

example ESM import

import * as oauth2 from '@panva/oauth4webapi'

example Deno import

import * as oauth2 from 'https://deno.land/x/doauth/src/index.ts'

Runtime requirements

The supported javascript runtimes include ones that

Other than browsers the supported runtimes are

  • Deno (^1.21.0)
  • Cloudflare Workers
  • Vercel Edge Functions
  • Next.js Middlewares
  • Electron (renderer process)

Pending runtime support

Out of scope

  • CommonJS
  • OAuth 2.0 & OpenID Connect Implicit Flows
  • OAuth 2.0 Resource Owner Password Credentials
  • OpenID Connect Hybrid Flows
  • MTLS (because fetch does not support client certificates)
  • JWS HMAC Signed Responses
  • JWE Encrypted Messages