-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[docs] Add bot token unmerge endpoint documentation #7886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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. | ||||||
| </Info> | ||||||
|
|
||||||
| #### 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() | ||||||
| ``` | ||||||
|
|
||||||
| <Tip> | ||||||
| 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. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like autocorrect got involved.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Appreciate the find - but this is already merged. Would love a small PR to fix! |
||||||
| </Tip> | ||||||
|
|
||||||
| ### Unmerging Provisional Accounts for Public Clients | ||||||
|
|
||||||
| <PublicClient /> | ||||||
|
|
@@ -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 | ||||||
| [`Client::UpdateProvisionalAccountDisplayName`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a7485979ab2d4c533b75f8efd5e50bc60 | ||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to mention that you can use this to unmerge even if you've lost the discord auth token?
Something like:
WDYT?