
Sign in to Cloudflare Access with Discord. Keep your self-hosted apps behind the gate, and let through only the members of your server.
Someone opens one of your apps. Cloudflare Access stops them at the gate.
They choose Discord, and Discord asks if Herugrim may know who they are.
Are they of your server? Do they bear the admin role? Both are optional.
Access lets them through, and your app is handed a signed token.
The token Access passes to your app carries a discord_user claim: who they are and whether they're an admin, without your app ever calling Discord.
{
"discord_user": {
"id": "80351110224678912",
"username": "theoden",
"global_name": "Théoden",
"is_admin": true
}
}
CLIENT_ID · CLIENT_SECRETFrom your Discord application. The secret is kept by Wrangler, never in the code.
REDIRECT_URIYour Cloudflare Access callback address.
ALLOWED_GUILDSOptional. Only members of these Discord servers may pass.
ADMIN_ROLE_IDOptional. Bearers of this role are marked as admins, and the extra Discord permission is only asked for when it's set.