Adds OAuth2 login to Payload CMS v3 through an authorize endpoint on an auth collection, which redirects users to the provider. It works with generic OAuth2 providers and has been tested with Google and Zitadel, with an Apple example config. The plugin has no runtime dependencies and is configurable.
OAuth2 plugin for Payload CMS
Installation
npm i payload-oauth2198
Stars
21
Forks
8
Open Issues
5 months ago
Last Updated
0
Weekly Downloads
v1.0.21
npm Version
72.9 KB
Unpacked Size
0
Dependencies
Trends appear after 7 days of data. Daily snapshots have not started yet.
Trends appear after 7 days of data. Daily snapshots have not started yet.
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/793272573-root)<a href="https://payloaddirectory.dev/plugins/793272573-root"><img src="https://payloaddirectory.dev/badge/793272573-root.svg" alt="Payload Directory"></a>README
Technically this plugin should work with all generic OAuth2 providers. Here are the list of providers that have been tested:
| Provider | Status | Example |
|---|---|---|
| Config | ||
| Zitadel | Config | |
| Apple | Test not implemented | Config |
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.
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.
Contributions and feedback are very welcome.
To get it running:
pnpm installpnpm devThe MIT License (MIT). Please see License File for more information.
This package was inspired by Payload Plugin OAuth.
Topics
payload better auth
Better Auth database adapter and plugins that replace Payload's local auth strategy
700/wk74v3
payload simple social login
Google and Microsoft Entra ID social login for the Payload admin panel and auth collections
650/wk3v3
payload auth
Replaces Payload's built-in auth with Better Auth, sharing one session between the admin panel and your app
590/wk344v3
payload authjs
Use Auth.js 5 providers to sign in and authenticate users in Payload CMS 3
560/wk207v3
payload keycloak
Keycloak SSO login for the Payload admin using OIDC with PKCE, silent refresh and permission-based access helpers
500/wk0v3
payload auth plugin
Authentication plugin adding OAuth, OpenID Connect, SSO and passkey sign-in to Payload CMS
500/wk310v3