wyrt_oauth

v1.0.0Auth

OAuth authentication module supporting Discord, Google, Steam, and other providers

Features

  • Discord OAuth2 integration
  • Google OAuth2 integration (planned)
  • Steam OpenID integration (planned)
  • Automatic account linking
  • JWT token generation
  • Provider configuration via server.json or env vars
  • HTTP route registration (/oauth/:provider)
  • Callback handling and token exchange

Quick Start

// Configure in server.json:
// {
//   "oauth": {
//     "jwtSecret": "your-secret",
//     "providers": {
//       "discord": {
//         "enabled": true,
//         "clientId": "...",
//         "clientSecret": "...",
//         "callbackUrl": "https://yourgame.com/oauth/discord/callback"
//       }
//     }
//   }
// }

// OAuth routes are auto-registered:
// GET /oauth/discord - Redirects to Discord login
// GET /oauth/discord/callback - Handles callback

// Access OAuth manager for custom integration
const oauthModule = context.getModule('wyrt_oauth');
const oauthManager = oauthModule.getOAuthManager();

Exports

OAuthManager

Manages OAuth providers and authentication

DiscordProvider

Discord OAuth2 provider implementation