A Discord verification bot with anti-alt detection, VPN blocking, and device fingerprinting.
- OAuth2 Discord verification flow
- VPN/Proxy detection via VpnApi
- Device fingerprinting to prevent alts
- IP duplicate detection
- Account age requirements
- Blacklist management (users & IPs)
- Auto-kick after failed attempts
- Member pullback (re-add verified users who left)
- Bun runtime
- PostgreSQL 17
- Discord Bot
- VPNAPI.io API key (free tier: 1000 requests/day)
-
Clone and install
git clone https://github.com/JustBlaxe/DiscordAuthBot.git cd authbot bun install -
Configure environment
cp .env.example .env
Generate an encryption key:
openssl rand -hex 32
-
Discord Developer Portal
- Create application at https://discord.com/developers
- Add redirect URI:
https://yourdomain.com/callback - Copy Bot Token, Client ID, and Client Secret
-
Discord Server Setup
- Ensure bot role is above Member role
- Copy all IDs to
.env
| Variable | Description |
|---|---|
DISCORD_TOKEN |
Bot token |
DISCORD_CLIENT_ID |
OAuth2 client ID |
DISCORD_CLIENT_SECRET |
OAuth2 client secret |
GUILD_ID |
Server ID |
REDIRECT_URI |
OAuth2 callback URL (HTTPS in prod) |
CHANNEL_VERIFY |
Verification channel ID |
CHANNEL_LOGS |
Logs channel ID |
ROLE_MEMBER |
Verified member role ID |
ROLE_ADMIN |
Admin role ID (for commands) |
DATABASE_URL |
PostgreSQL connection string |
ENCRYPTION_KEY |
32-byte hex key for token encryption |
VPNAPI_KEY |
VPNAPI.io API key |
TRUST_PROXY |
Set true if behind reverse proxy |
CORS_ORIGIN |
Override CORS origin (optional) |
All commands require the Admin role.
| Command | Description |
|---|---|
/help |
List commands |
/check <user> |
View user's verification data |
/stats |
Verification statistics with graph |
/audit |
Recent verification attempts |
/pullback |
Re-add verified members who left |
/blacklist add <type> <value> <reason> |
Blacklist user/IP |
/blacklist remove <value> |
Remove from blacklist |
/blacklist list |
View blacklist |
- Use HTTPS (required for Discord OAuth2)
- Set
TRUST_PROXY=trueif behind nginx/Cloudflare - Set
CORS_ORIGINto your domain
Example nginx config:
server {
listen 443 ssl;
server_name verify.yourdomain.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}MIT