This is the AuthPenguin server with security, modular architecture, and admin controls.
server/
├── src/
│ ├── config/
│ │ ├── database.js # Redis configuration
│ │ └── passport.js # Passport.js configuration
│ ├── middleware/
│ │ └── auth.js # Authentication & security middleware
│ ├── routes/
│ │ ├── admin.js # Admin management routes
│ │ ├── auth.js # General auth routes
│ │ ├── oauth.js # OAuth provider routes
│ │ ├── scratch.js # Scratch authentication
│ │ └── soundcloud.js # SoundCloud authentication
│ ├── strategies/
│ │ ├── scratch.js # Custom Scratch strategy
│ │ └── soundcloud.js # Custom SoundCloud strategy
│ └── utils/
│ └── admin.js # Admin utility functions
├── public/
│ ├── admin.html # Admin dashboard
│ ├── auth-selector.html # OAuth provider selector
│ ├── index.html # Main landing page
│ ├── privacy.html # Privacy policy
│ ├── scratch-auth.html # Scratch authentication page
│ └── terms.html # Terms of service
├── server.js # server file
└── package.json
- Origin Validation: Only allows requests from trusted origins (TurboWarp, PenguinMod, localhost) (Not actually sure if it works right now)
- Rate Limiting: Prevents abuse with configurable rate limits
- Project Blocking: Ability to block specific projects from using OAuth
- Admin Authentication: Secure admin panel with key-based authentication
- Block projects by ID or shared project URLs
- Support for both regular projects and shared projects (PenguinMod URLs)
- Admin dashboard for managing blocked projects
- Reason tracking for blocks with timestamps
- Modular route structure
- Separated middleware and utilities
- Configuration files for easy maintenance
- Proper error handling and logging
Here's the updated markdown with instructions to copy .env.template to .env and modify it:
First, copy the .env.template file to .env:
cp .env.template .envThen, open the .env file and update the values based on what they do (showed on the comments
GET /auth/selector- OAuth provider selector pageGET /auth/discord- Discord OAuthGET /auth/google- Google OAuthGET /auth/github- GitHub OAuthGET /auth/scratch- Scratch authentication pageGET /auth/soundcloud- SoundCloud OAuthGET /auth/status- Check authentication statusPOST /auth/logout- Logout userGET /auth/failure- Authentication failure handler
POST /admin/block- Block a projectPOST /admin/unblock- Unblock a projectGET /admin/blocked- List blocked projectsGET /admin/status- Check project block status (public, rate-limited)
X-Project-Id: Project identifier (required for all auth requests)X-Admin-Key: Admin key (required for admin endpoints)Origin: Request origin (validated against whitelist)
# Install dependencies
npm install
# or
bun install
# Start the server
node server.js
# or
bun run server.jsAccess the admin dashboard at http://localhost:3000/admin.html
Projects can be blocked in two ways:
- Regular Projects: Use the project ID
- Shared Projects: Use the shared project ID from URLs like
https://studio.penguinmod.com/#4643884053
- All authentication requests require a valid
X-Project-Idheader - Origins are validated against a whitelist
- Rate limiting is applied to prevent abuse
- Admin endpoints require the
ADMIN_KEYenvironment variable
The server includes:
- nothing
- try and error type of project lmaoooo (i might change it)