Discord linking
GridCraft can attach a Discord identity to your account. We only request the identify scope. If Discord OAuth isn't configured on the server, the start endpoint returns 503.
GET /auth/discord/start
Authenticated. Returns the Discord authorize URL the frontend should redirect to. The URL embeds a short-lived signed state JWT carrying your user ID.
200 OK
{ "url": "https://discord.com/api/oauth2/authorize?..." }
Errors
503 DISCORD_DISABLED (server isn't configured for Discord OAuth)GET /auth/discord/callback
Public. Discord calls this with ?code and ?state. The handler exchanges the code, fetches the Discord profile, writes discordId and discordUsername to the user row, then 302-redirects back to the dashboard.
Errors come back as redirects too, with ?discord=error&reason=.... Reasons include disabled, missing_params, bad_state, oauth_failed, already_linked, and cancelled (the user clicked "Cancel" on Discord). On success the query becomes ?discord=linked.
A Discord identity can only be linked to one GridCraft account at a time. Attempting to link one already bound elsewhere redirects with reason already_linked.
POST /auth/discord/unlink
Authenticated. Clears the Discord columns on your user row.
200 OK
{ "success": true }