> ## Documentation Index
> Fetch the complete documentation index at: https://docs.discord.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Unlinking Accounts

> Best practices for unlinking a user's Discord account from your game, including when to revoke tokens and how to avoid relinking conflicts.

export const SlashBoxIcon = props => <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="currentColor" fill-rule="evenodd" d="M5 2a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V5a3 3 0 0 0-3-3H5Zm12.79 3.37a.25.25 0 0 0-.22-.37h-3.13a.75.75 0 0 0-.66.38L6.21 18.63c-.1.16.03.37.22.37h3.13c.27 0 .52-.14.66-.38l7.57-13.25Z" clip-rule="evenodd" /></svg>;

export const UserPlusIcon = props => <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="currentColor" d="M19 14a1 1 0 0 1 1 1v3h3a1 1 0 0 1 0 2h-3v3a1 1 0 0 1-2 0v-3h-3a1 1 0 1 1 0-2h3v-3a1 1 0 0 1 1-1Z" /><path fill="currentColor" d="M16.83 12.93c.26-.27.26-.75-.08-.92A9.5 9.5 0 0 0 12.47 11h-.94A9.53 9.53 0 0 0 2 20.53c0 .81.66 1.47 1.47 1.47h.22c.24 0 .44-.17.5-.4.29-1.12.84-2.17 1.32-2.91.14-.21.43-.1.4.15l-.26 2.61c-.02.3.2.55.5.55h7.64c.12 0 .17-.31.06-.36C12.82 21.14 12 20.22 12 19a3 3 0 0 1 3-3h.5a.5.5 0 0 0 .5-.5V15c0-.8.31-1.53.83-2.07ZM12 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z" /></svg>;

## Overview

<Tip>
  This guide covers unlinking for games using the standard [OAuth2 account linking flow](/developers/discord-social-sdk/development-guides/account-linking-with-discord). If your game uses [Provisional Accounts](/developers/discord-social-sdk/development-guides/provisional-accounts/overview) instead, unlinking works differently. See [Unmerging Accounts](/developers/discord-social-sdk/development-guides/provisional-accounts/unmerging-accounts) when working with Provisional Accounts.
</Tip>

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](/developers/discord-social-sdk/development-guides/account-linking-with-discord#revoking-access-tokens) in the Account Linking guide for the server-side endpoint and the [`Client::RevokeToken`] method for public clients.

<Warning>
  Revoking a token invalidates all access and refresh tokens your application has issued for that user, not just the one you pass in.
</Warning>

### 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:

1. 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.
2. Relinking to a different Discord or game account can conflict with leftover data tied to the old token. See [Resolving Relink Conflicts](/developers/discord-social-sdk/development-guides/unlinking-accounts#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](/developers/resources/application-identity-profile) used by features like [Game Stats Widgets](/developers/social-layer/game-stats-widgets/overview), as an error such as `"Application identity for this external account already exists for another user"`.

See [Resolving External ID Conflicts](/developers/social-layer/game-stats-widgets/best-practices#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 the [`APPLICATION_DEAUTHORIZED`](/developers/events/webhook-events#application-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](/developers/discord-social-sdk/development-guides/account-linking-with-discord#out-of-band-revocation) for details.

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Account Linking from Your Game" href="/developers/discord-social-sdk/development-guides/account-linking-with-discord" icon={<UserPlusIcon />}>
    The standard OAuth2 flow, including how to revoke and refresh tokens.
  </Card>

  <Card title="Unmerging Accounts" href="/developers/discord-social-sdk/development-guides/provisional-accounts/unmerging-accounts" icon={<SlashBoxIcon />}>
    The equivalent unlinking flow for games using Provisional Accounts.
  </Card>
</CardGroup>

Need help? Join the [Discord Developers Server](https://discord.gg/discord-developers) and share questions in the `#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](https://dis.gd/social-sdk-bug-report)

***

## Change Log

| Date               | Changes         |
| ------------------ | --------------- |
| September 17, 2026 | Initial release |

[`Client::RevokeToken`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a30ccea6366efaf0b884efcdcc28a6f2d
