Skip to content
aicoolies logo
Cloudflare logo

workers-oauth-provider

OAuth 2.1 provider framework for Cloudflare Workers

workers-oauth-provider is Cloudflare's official OAuth provider library for Workers. It implements the provider side of the OAuth 2.1 protocol with PKCE support and RFC 8414 compliance. Handles token management automatically via Cloudflare KV storage. Gives fullstack teams a path to implement OAuth at the edge without heavy auth servers. TypeScript-native with npm package available.

About workers-oauth-provider

Workers OAuth Provider is Cloudflare's official TypeScript library that implements the provider side of the OAuth 2.1 protocol for Cloudflare Workers, designed specifically to add authorization to remote MCP servers and API endpoints. It implements the full suite of specifications required by the MCP authorization standard: OAuth 2.1 with PKCE (draft-ietf-oauth-v2-1-13), Authorization Server Metadata (RFC 8414), Protected Resource Metadata (RFC 9728), Dynamic Client Registration (RFC 7591), and Client ID Metadata Documents. The library wraps around existing Worker code, automatically handling token management, authorization flows, and session validation while passing authenticated user details directly to API handlers.

The library emerged as a critical piece of MCP infrastructure after the Model Context Protocol specification mandated OAuth 2.1 with PKCE for all public remote servers in November 2025. Without it, developers building remote MCP servers on Cloudflare Workers would need to implement the full OAuth 2.1 flow from scratch — a complex and security-sensitive task involving PKCE code challenges, token rotation, and metadata endpoint configuration. The library reduces this to a few lines of configuration, making it practical for individual developers and small teams to deploy authenticated MCP servers. It integrates naturally with Cloudflare's Durable Objects for session storage and KV for token persistence.

Published on npm as @cloudflare/workers-oauth-provider with over 1,700 GitHub stars, the library has become the de facto standard for adding authentication to Cloudflare-hosted MCP servers. The project maintains active development with security-conscious practices — a PKCE bypass vulnerability discovered through responsible disclosure was quickly patched, demonstrating the security scrutiny the library receives. It ships under the MIT license with comprehensive documentation on Cloudflare's developer docs, example implementations, and integration guides for popular identity providers including Stytch, Auth0, and Clerk.

Pricing & Platform Specs

Pricing Summary

Cloudflare workers-oauth-provider is an open-source OAuth 2.1 authorization server library licensed under MIT, designed to run natively on Cloudflare Workers edge runtime.

Supported Platforms

Cloudflare Workers, TypeScript

Explore categories, tags & use cases

Open-source identity provider for self-hosted SSO and access management

Authentik is an open-source Identity Provider supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and SCIM for self-hosted single sign-on. It provides customizable authentication flows, multi-factor authentication, user management, and proxy-based SSO for applications without native support. Positioned as a modern Keycloak alternative with 22K+ GitHub stars, free Open Source use, and paid Enterprise/Enterprise Plus plans.

freemiumOpen Source

ORM for TypeScript and JavaScript

Full-featured ORM for TypeScript and JavaScript supporting Active Record and Data Mapper patterns. Works with PostgreSQL, MySQL, MariaDB, SQLite, Oracle, SQL Server, and MongoDB. Features decorator-based entity definitions, migrations, relations (one-to-one, many-to-many), lazy/eager loading, query builder, transactions, and caching. Supports both Node.js and browser runtimes. 34K+ GitHub stars. Mature but losing mindshare to Prisma and Drizzle for new TypeScript projects.

Open Source

Community experience

Sources & verification

Sources checked
Content verified

Verification dates are editorial checks. Routine CMS saves and automatic updatedAt timestamps do not advance them.

FAQ

What is workers-oauth-provider?

workers-oauth-provider is Cloudflare's official OAuth provider library for Workers. It implements the provider side of the OAuth 2.1 protocol with PKCE support and RFC 8414 compliance. Handles token management automatically via Cloudflare KV storage. Gives fullstack teams a path to implement OAuth at the edge without heavy auth servers. TypeScript-native with npm package available.

Is workers-oauth-provider free?

Yes — workers-oauth-provider is open source and free to use. Cloudflare workers-oauth-provider is an open-source OAuth 2.1 authorization server library licensed under MIT, designed to run natively on Cloudflare Workers edge runtime.

Is workers-oauth-provider open source?

Yes — workers-oauth-provider is open source.

Is workers-oauth-provider still maintained?

Yes — workers-oauth-provider is active. Its listing was last verified on August 26, 2026.

What are the best workers-oauth-provider alternatives?

The first editor-selected workers-oauth-provider alternatives are Authentik, TypeORM.