Overview
When a player unlinks their Discord account from your game (for example, from an in-game settings menu), your game typically removes its own record of the association between the game account and the Discord account. On its own, that only updates your side of the relationship. Discord still considers your application authorized unless you also revoke the player’s OAuth2 tokens.Always Revoke Tokens When Unlinking
Whenever your game unlinks a user’s Discord account, revoke that user’s access and refresh tokens at the same time. Don’t treat unlinking as a purely local operation. See Revoking Access Tokens in the Account Linking guide for the server-side endpoint and theClient::RevokeToken method for public clients.
What Happens If You Don’t Revoke
If you remove your own link between a game account and a Discord account without revoking the token, two things follow:- Your application still shows as authorized on the user’s Discord User Settings → Authorized Apps page. This has little functional impact on its own, but users may reach out about it if they expect unlinking in your game to also disconnect it on Discord’s side.
- Relinking to a different Discord or game account can conflict with leftover data tied to the old token. See Resolving Relink Conflicts below to handle this.
Resolving Relink Conflicts
If a user unlinks without a token revocation and later links a different game account to Discord (or vice versa), you may be unable to send us game data for the new pairing. This typically surfaces through the Application Identity Profile API used by features like Game Stats Widgets, as an error such as"Application identity for this external account already exists for another user".
See Resolving External ID Conflicts for the cleanup steps. Run that cleanup whenever you encounter this error, caused by stale identity data from a prior link. Once resolved, you should be able to send game data for the new account normally.
Handling Out-of-Band Unlinks
Users can also unlink your application directly from Discord’s UI without ever using your in-game unlink flow. Subscribe to theAPPLICATION_DEAUTHORIZED webhook event so your backend can treat it the same as an in-game unlink (clearing your stored tokens and local link record) rather than only discovering it when the next token refresh fails. See Out-of-Band Revocation for details.
Next Steps
Account Linking from Your Game
The standard OAuth2 flow, including how to revoke and refresh tokens.
Unmerging Accounts
The equivalent unlinking flow for games using Provisional Accounts.
#social-sdk-dev-help channel for support from the community.
If you encounter a bug while working with the Social SDK, please report it here: https://dis.gd/social-sdk-bug-report