A robust Discord verification system that uses OAuth2 to verify users through a web interface before granting them access to your server.
- π Clean web interface for verification
- π Secure OAuth2 authentication through Discord
- πΎ MongoDB integration for user data storage
- π€ Discord bot for role management
- β‘ Express.js backend
- π¨ Customizable branding and colors
- π Verification tracking and statistics
- π Admin commands for role management
- Node.js v16.9.0 or higher
- MongoDB installed and running
- A Discord application with bot user
- Discord Developer Portal access
- Go to the Discord Developer Portal
- Create a "New Application" and give it a name
- Go to the "Bot" section and click "Add Bot"
- Copy the bot token and save it for later
- Under "OAuth2" settings:
- Add your redirect URL (e.g.
http://localhost:3000/auth/discord/callback
) - Copy the Client ID and Client Secret
- Enable the following scopes:
identify
guilds
guilds.join
- Add your redirect URL (e.g.
- Clone the repository:
git clone https://github.com/KoopaCode/Koopa-Oauth.git cd koopas-verification
- Install dependencies:
npm install
- Copy
.env.example
to.env
:cp .env.example .env
-
Edit the
.env
file with your settings:DISCORD_CLIENT_ID=your_client_id_here DISCORD_CLIENT_SECRET=your_client_secret_here DISCORD_BOT_TOKEN=your_bot_token_here ADMIN_ROLE_ID=your_admin_role_id_here SERVER_NAME="Your Server Name" MONGODB_URI=mongodb://127.0.0.1:27017/verification CALLBACK_URL=http://localhost:3000/auth/discord/callback SESSION_SECRET=your_random_secret_here PORT=3000
-
Customize branding in
config/embedConfig.js
:- Set your server colors
- Update footer icons
- Modify embed styling
- Invite the bot to your server using the OAuth2 URL generator:
- Required permissions:
- Manage Roles
- View Channels
- Send Messages
- Embed Links
- Required permissions:
- Ensure the bot role is higher than the verification role in your server's role hierarchy
- Start MongoDB if not running:
mongod
- The application will automatically create required collections
- Start in development mode:
npm run dev
- Or production mode:
npm start
- Access the verification page at
http://localhost:3000
Available slash commands:
/verify role
- Set the verification role (Admin only)/verify list
- View recently verified users (Admin only)/verify send (channel)
- Send Verification Embed to a channel (Admin only)/verify join (guildID)
- Make everyone join the guild (Admin only)
- Ensure all environment variables are correctly set
- Check MongoDB connection is active
- Verify bot has proper permissions in Discord server
- Confirm OAuth2 redirect URIs match your configuration
- Review logs for any error messages
- Keep your
.env
file secure and never commit it - Regularly rotate your
SESSION_SECRET
- Use HTTPS in production
- Regularly update dependencies
- Monitor verification logs for suspicious activity