A secure Cloudflare Worker that automates Discord access for your Patreon supporters. It connects your Patreon and Discord accounts, checks supporter eligibility, and grants Discord server access or roles—no coding required.
- Discord OAuth2 authentication and callback handling
- Patreon OAuth2 authentication and callback handling
- Automatic Discord guild membership and role assignment based on Patreon tiers
- Dynamic redirect URIs based on request host and protocol
- Secure secret management via Wrangler
- Type-safe request/response validation
- No passwords or personal data stored
- Supporters log in with Discord and Patreon.
- The worker checks their Patreon membership.
- If eligible, they’re added to your Discord server and given a special role.
See SETUP.md for a complete step-by-step setup guide, including prerequisites, configuration, deployment, and troubleshooting.
/auth
— Starts Discord OAuth flow/auth/discord/init
— Discord OAuth2 authorization/auth/discord/callback
— Discord OAuth2 callback/auth/patreon/handover
— Patreon OAuth2 authorization/auth/patreon/callback
— Patreon OAuth2 callback/auth/finish
— Token exchange, user info fetch, guild/role management
src/index.ts
— Main router and OAuth logicsrc/helpers.ts
— Redirect helpers, token revocation, and utility functionssrc/types.ts
— Type definitions for Discord, Patreon, and API payloadssrc/routes/
— Modular route files for each endpointpackage.json
— Project dependencies and scriptsREADME.md
— Project documentation
- OAuth2 is used for both Discord and Patreon; passwords are never stored or seen.
- All secrets (API keys, tokens) are stored securely in Cloudflare and never exposed.
- Tokens are revoked after use for extra security.
- Only eligible users are added to your Discord server.
- No personal data is stored on the worker; it only checks membership and grants access.
A secure Cloudflare Worker that connects your Patreon and Discord accounts. It automatically gives your Patreon supporters access to a private Discord server or role, based on their membership.
- Deploy the worker using Cloudflare and Wrangler.
- Set up your Discord and Patreon credentials as secrets.
- Share the authentication link with your supporters.
- OAuth2 is used for both Discord and Patreon, so passwords are never stored or seen.
- All secrets (API keys, tokens) are stored securely in Cloudflare and never exposed.
- Only eligible users are added to your Discord server.
- No personal data is stored on the worker; it only checks membership and grants access.
This project automates Discord access for Patreon supporters, is easy to set up, and keeps your credentials and user data secure.