diff --git a/discord/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts.mdx b/discord/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts.mdx index b044138459..a8b347c441 100644 --- a/discord/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts.mdx +++ b/discord/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts.mdx @@ -496,6 +496,32 @@ def unmerge_provisional_account(external_auth_token): If you have a server backend, you'll want to use the server-to-server unmerge endpoint rather than the SDK helper method to maintain better security and control over the unmerge process. +#### Unmerging with Bot Token Endpoint + +If you're using the [Bot Token Endpoint](/docs/discord-social-sdk/development-guides/using-provisional-accounts#server-authentication-with-bot-token-endpoint) for authentication, you can unmerge accounts without an external auth token. + +```python +import requests + +API_ENDPOINT = 'https://discord.com/api/v10' +BOT_TOKEN = 'YOUR_BOT_TOKEN' + +def unmerge_provisional_account(external_user_id): + data = { + 'external_user_id': external_user_id # identifier used in the /token/bot endpoint + } + headers = { + 'Content-Type': 'application/json', + 'Authorization': f'Bot {BOT_TOKEN}' + } + r = requests.post('%s/provisional-accounts/unmerge/bot' % API_ENDPOINT, json=data, headers=headers) + r.raise_for_status() +``` + + +This endpoint can also be useful in cases where the Discord Auth token has been lost to to error or data loss, and an unmerge operation is required to migrate to a provisional account before re-linking a Discord account. + + ### Unmerging Provisional Accounts for Public Clients @@ -621,4 +647,4 @@ import {UserStatusIcon} from '/snippets/icons/UserStatusIcon.jsx' [`Client::GetTokenFromProvisionalMerge`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a41062b7dafa331ddd2320daf1b4b273b [`Client::SetTokenExpirationCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#aab5bfc76809ea22e79f2f7a067ac4519 [`Client::UnmergeIntoProvisionalAccount`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a2da21ae8a3015e0e5e42c1a7226b256f -[`Client::UpdateProvisionalAccountDisplayName`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a7485979ab2d4c533b75f8efd5e50bc60 \ No newline at end of file +[`Client::UpdateProvisionalAccountDisplayName`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a7485979ab2d4c533b75f8efd5e50bc60