Discord OAuth2 Setup¶
PoracleWeb.NET uses Discord OAuth2 for user authentication. This page walks through creating and configuring a Discord application.
Create a Discord application¶
- Go to the Discord Developer Portal
- Click New Application and give it a name
-
Under OAuth2, add redirect URIs:
Environment Redirect URI Production / Docker http://your-domain:8082/api/auth/discord/callbackDevelopment http://localhost:4200/api/auth/discord/callbackThe redirect URI must match the origin the browser is on, because
AuthControllerbuilds the callback from the incoming request. In production the API and the SPA share an origin, so this is simply your domain. In development the browser is on the Angular dev server (4200) andproxy.conf.jsonsetschangeOrigin: false, so theHoststayslocalhost:4200— register that, not the API's 5048. If you serve the dev app on another port, register that port instead.Behind a reverse proxy, set
PUBLIC_URLDeriving the callback from the request goes wrong when TLS is terminated in front of the app: it sees plain HTTP and builds an
http://callback that Discord rejects as unregistered. SettingPUBLIC_URL=https://poracle.example.comin.envpins the callback to exactly what you registered here, whatever the request looks like. Declaring the proxy withPROXY_KNOWN_PROXIES/PROXY_KNOWN_NETWORKSfixes the same thing at source and additionally keeps rate limits per-user — see Behind a reverse proxy. -
Copy the Client ID and Client Secret
Optional: Create a bot¶
Creating a bot under the same application enables:
- Avatar display — User avatars shown in the UI
- Geofence forum posts — Automatic Discord forum threads for geofence submissions
Bot permissions for geofence forum¶
If using the geofence submission feature with Discord forum integration, the bot needs these permissions on the forum channel:
| Permission | Purpose |
|---|---|
| View Channel | Access the forum channel |
| Send Messages in Threads | Post status updates in threads |
| Manage Threads | Lock and archive threads on approval/rejection |
| Manage Channels | Auto-create forum tags (Pending/Approved/Rejected) |
Tip
If the bot doesn't have Manage Channels permission, create the forum tags (Pending, Approved, Rejected) manually on the channel.
Configuration¶
These values are set during ./scripts/setup.sh, or you can edit .env directly:
Discord API domain
PoracleWeb.NET uses discordapp.com (not discord.com) for API calls. The discord.com domain is blocked by Cloudflare in some server environments. This is already configured in the application — no action needed.