WilsonLe

payload oauth2

by WilsonLe
Authentication & SSO
v3
^3
MIT

Overview

Summary generated from the README

Adds OAuth2 authentication to a Payload v3 auth collection, working with generic OAuth2 providers. Login starts from a browser navigation to an authorize endpoint on the collection's API route. It has no runtime dependencies and is configured through the plugin options. Google and Zitadel are tested, and an Apple config example is included.

Features

  • Works with generic OAuth2 providers
  • Tested with Google and Zitadel, with an Apple example config
  • Authorize endpoint exposed under the collection API route
  • Ignores Next.js RSC navigation probes on the authorize endpoint
  • No runtime dependencies
  • Customizable through plugin configuration

Use cases

  • Add Sign in with Google to a Payload admin panel or user collection
  • Connect Payload to an identity provider such as Zitadel for single sign-on
  • Offer Apple sign-in for users of a Next.js app backed by Payload

From the author

OAuth2 plugin for Payload CMS

Installation

npm i payload-oauth2

200

Stars

21

Forks

8

Open Issues

6 months ago

Last Updated

12.1k

Weekly Downloads

v1.0.21

npm Version

72.9 KB

Unpacked Size

0

Dependencies

GitHub stars

200+3 since Sep 7

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 2026200
Dec 5, 2026199
Dec 4, 2026199
Dec 3, 2026199
Dec 2, 2026199
Dec 1, 2026198
Nov 30, 2026198
Nov 29, 2026198
Nov 28, 2026198
Nov 27, 2026198
Nov 26, 2026198
Nov 25, 2026198
Nov 24, 2026198
Nov 23, 2026198
Nov 22, 2026198
Nov 21, 2026198
Nov 20, 2026198
Nov 19, 2026198
Nov 18, 2026198
Nov 17, 2026198
Nov 16, 2026198
Nov 15, 2026198
Nov 14, 2026198
Nov 13, 2026198
Nov 12, 2026198
Nov 11, 2026198
Nov 10, 2026198
Nov 9, 2026198
Nov 8, 2026198
Nov 7, 2026198
Nov 6, 2026198
Nov 5, 2026198
Nov 4, 2026198
Nov 3, 2026198
Nov 2, 2026198
Nov 1, 2026198
Oct 31, 2026198
Oct 30, 2026198
Oct 29, 2026198
Oct 28, 2026198
Oct 27, 2026198
Oct 26, 2026198
Oct 25, 2026198
Oct 24, 2026198
Oct 23, 2026198
Oct 22, 2026198
Oct 21, 2026198
Oct 20, 2026198
Oct 19, 2026198
Oct 18, 2026198
Oct 17, 2026198
Oct 16, 2026198
Oct 15, 2026198
Oct 14, 2026198
Oct 13, 2026198
Oct 12, 2026198
Oct 11, 2026198
Oct 10, 2026198
Oct 9, 2026198
Oct 8, 2026198
Oct 7, 2026198
Oct 6, 2026198
Oct 5, 2026198
Oct 4, 2026198
Oct 3, 2026198
Oct 2, 2026198
Oct 1, 2026198
Sep 30, 2026197
Sep 29, 2026197
Sep 28, 2026197
Sep 27, 2026197
Sep 26, 2026197
Sep 25, 2026197
Sep 24, 2026197
Sep 23, 2026197
Sep 22, 2026197
Sep 21, 2026197
Sep 20, 2026197
Sep 19, 2026197
Sep 18, 2026197
Sep 17, 2026197
Sep 16, 2026197
Sep 15, 2026197
Sep 14, 2026197
Sep 13, 2026197
Sep 12, 2026197
Sep 11, 2026197
Sep 10, 2026197
Sep 9, 2026197
Sep 8, 2026197
Sep 7, 2026197
npm weekly downloads

12.1K−456 since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 202612,089
Dec 5, 202611,895
Dec 4, 202611,972
Dec 3, 202611,612
Dec 2, 202611,717
Dec 1, 202612,089
Nov 30, 202612,006
Nov 29, 202613,046
Nov 28, 202613,437
Nov 27, 202613,767
Nov 26, 202614,517
Nov 25, 202615,470
Nov 24, 202616,191
Nov 23, 202617,273
Nov 22, 202617,262
Nov 21, 202618,754
Nov 20, 202619,860
Nov 19, 202622,196
Nov 18, 202623,773
Nov 17, 202623,659
Nov 16, 202623,394
Nov 15, 202625,334
Nov 14, 202626,827
Nov 13, 202630,145
Nov 12, 202630,155
Nov 11, 202631,051
Nov 10, 202630,569
Nov 9, 202630,485
Nov 8, 202629,421
Nov 7, 202626,850
Nov 6, 202623,136
Nov 5, 202621,572
Nov 4, 202621,351
Nov 3, 202621,706
Nov 2, 202621,426
Nov 1, 202621,214
Oct 31, 202622,303
Oct 30, 202623,059
Oct 29, 202619,661
Oct 28, 202614,115
Oct 27, 202613,914
Oct 26, 202613,764
Oct 25, 202614,181
Oct 24, 202614,517
Oct 23, 202610,455
Oct 22, 202614,024
Oct 21, 202617,144
Oct 20, 202617,207
Oct 19, 202616,981
Oct 18, 202615,839
Oct 17, 202614,476
Oct 16, 202616,947
Oct 15, 202616,657
Oct 14, 202615,633
Oct 13, 202615,002
Oct 12, 202614,842
Oct 11, 202614,802
Oct 10, 202615,377
Oct 9, 202615,684
Oct 8, 202615,048
Oct 7, 202615,737
Oct 6, 202615,717
Oct 5, 202615,553
Oct 4, 202615,717
Oct 3, 202615,612
Oct 2, 202616,536
Oct 1, 202616,753
Sep 30, 202617,686
Sep 29, 202617,921
Sep 28, 202618,585
Sep 27, 202619,588
Sep 26, 202619,914
Sep 25, 202619,815
Sep 24, 202622,231
Sep 23, 202621,823
Sep 22, 202621,539
Sep 21, 202620,775
Sep 20, 202620,159
Sep 19, 202620,445
Sep 18, 202620,736
Sep 17, 202618,517
Sep 16, 202617,675
Sep 15, 202617,860
Sep 14, 202618,129
Sep 13, 202617,370
Sep 12, 202615,750
Sep 11, 202614,446
Sep 10, 202613,421
Sep 9, 202613,010
Sep 8, 202612,657
Sep 7, 202612,545

Each point is npm's rolling 7-day download count.

Health Score

69/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/793272573-root.svg)](https://payloaddirectory.dev/plugins/793272573-root)
HTML
<a href="https://payloaddirectory.dev/plugins/793272573-root"><img src="https://payloaddirectory.dev/badge/793272573-root.svg" alt="Payload Directory"></a>
Updated May 12, 2026Created Apr 28, 2024Published May 12, 2026

README

Payload OAuth2 Plugin

Software License Issues NPM

Features

  • ✅ Compatible with Payload v3
  • 🔐 Configures OAuth2 with any providers
  • ✨ Zero dependencies
  • ⚙ Highly customizable

Integrations

Technically this plugin should work with all generic OAuth2 providers. Here are the list of providers that have been tested:

ProviderStatusExample
GoogleTest Google OAuthConfig
ZitadelTest Zitadel OAuthConfig
AppleTest not implementedConfig

Installation

npm install payload-oauth2
yarn install payload-oauth2
pnpm install payload-oauth2

If you are feeling adventurous and want to manage the plugin yourself, you can copy the src directory into your payload projects.

Starting the OAuth flow

Create a normal browser navigation to the Payload authorize endpoint from your login UI:

export function GoogleLoginButton() {
  return <a href="/api/users/oauth/google">Continue with Google</a>
}

In Next.js App Router apps, prefer not to start OAuth with next/link or router.push() for the authorize endpoint. The endpoint returns a redirect to the OAuth provider, not a React Server Component payload. The plugin defensively ignores Next.js RSC navigation probes so client routing can fall back without the noisy Failed to fetch RSC payload ... Falling back to browser navigation log, but normal document navigation is still the most direct option.

Contributing

Contributions and feedback are very welcome.

To get it running:

  1. Clone the project.
  2. pnpm install
  3. pnpm dev

License

The MIT License (MIT). Please see License File for more information.

Credits

This package was inspired by Payload Plugin OAuth.

Similar plugins