Skip to content

Commit 4025e49

Browse files
authored
Clarify Merging Provisional Accounts for Servers section (#8289)
Add parameter tables, explain grant_type values, link to OAuth2 reference, document bot token merge using DISCORD_BOT_ISSUED_ACCESS_TOKEN.
1 parent c262bd0 commit 4025e49

1 file changed

Lines changed: 37 additions & 9 deletions

File tree

developers/discord-social-sdk/development-guides/using-provisional-accounts.mdx

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -313,17 +313,32 @@ If you are testing your merge integration, make sure to add your QA users to you
313313

314314
### Merging Provisional Accounts for Servers
315315

316-
To merge provisional accounts, include `external_auth_type` and `external_auth_token` values with a request to `/oauth2/token`. Discord will look up the Provisional User associated with the provided identity and attempt to merge it in to the full Discord account that generated the provided `code`.
316+
To merge a provisional account, extend the standard [OAuth2 token exchange](/developers/topics/oauth2#authorization-code-grant-access-token-exchange-example) by posting to `/oauth2/token` with two additional parameters — `external_auth_type` and `external_auth_token`. Discord uses these to identify the provisional account and merge it into the full Discord account associated with the provided authorization code or device code.
317+
318+
See the [External Auth Types](#external-auth-types) table above for the full list of supported `external_auth_type` values.
319+
320+
The `external_auth_token` is the same credential you provided when creating the provisional account — for example, your OIDC identity token, Steam session ticket, or EOS access token. If you created the provisional account using the [Bot Token Endpoint](#server-authentication-with-bot-token-endpoint), use `DISCORD_BOT_ISSUED_ACCESS_TOKEN` as the `external_auth_type` and the `external_user_id` (your game account ID) as the `external_auth_token`.
317321

318322
#### Desktop & Mobile
319323

324+
###### Request Body Parameters
325+
326+
| Parameter | Description |
327+
|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
328+
| `grant_type` | Must be `authorization_code`. This is the standard [OAuth2 authorization code grant](/developers/topics/oauth2#authorization-code-grant-access-token-exchange-example) — the authorization code from the [`Client::Authorize`] flow is exchanged for an access token. |
329+
| `code` | The authorization code returned to your server after the user completes the [`Client::Authorize`] flow. |
330+
| `redirect_uri` | The redirect URI used in the original authorization request. Must match exactly. |
331+
| `external_auth_type` | The type of external identity provider. See [External Auth Types](#external-auth-types). |
332+
| `external_auth_token` | The external identity token. For example, for `OIDC`, this is the OIDC identity token. For `DISCORD_BOT_ISSUED_ACCESS_TOKEN`, this is the `external_user_id` (game account ID) used when creating the provisional account. |
333+
320334
```python
321335
import requests
322336

323337
API_ENDPOINT = 'https://discord.com/api/v10'
324338
CLIENT_ID = '332269999912132097'
325339
CLIENT_SECRET = '937it3ow87i4ery69876wqire'
326-
EXTERNAL_AUTH_TYPE = 'OIDC' # See External Auth Types above
340+
# See External Auth Types above for all supported values
341+
EXTERNAL_AUTH_TYPE = 'DISCORD_BOT_ISSUED_ACCESS_TOKEN'
327342

328343
def exchange_code_with_merge(code, redirect_uri, external_auth_token):
329344
data = {
@@ -343,13 +358,25 @@ def exchange_code_with_merge(code, redirect_uri, external_auth_token):
343358

344359
#### Console
345360

361+
###### Request Body Parameters
362+
363+
| Parameter | Description |
364+
|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
365+
| `grant_type` | Must be `urn:ietf:params:oauth:grant-type:device_code`. This is the [RFC 8628](https://www.rfc-editor.org/rfc/rfc8628) device authorization grant, used for consoles and devices without a browser. |
366+
| `device_code` | The device code from the device authorization flow. See [Account Linking on Consoles](/developers/discord-social-sdk/development-guides/account-linking-on-consoles). |
367+
| `external_auth_type` | The type of external identity provider. See [External Auth Types](#external-auth-types). |
368+
| `external_auth_token` | The external identity token. For example, for `OIDC`, this is the OIDC identity token. For `DISCORD_BOT_ISSUED_ACCESS_TOKEN`, this is the `external_user_id` (game account ID) used when creating the provisional account. |
369+
346370
```python
347371
import requests
372+
348373
API_ENDPOINT = 'https://discord.com/api/v10'
349374
CLIENT_ID = '332269999912132097'
350375
CLIENT_SECRET = '937it3ow87i4ery69876wqire'
351-
EXTERNAL_AUTH_TYPE = 'OIDC'
352-
def exchange_device_code_with_merge(device_code):
376+
# See External Auth Types above for all supported values
377+
EXTERNAL_AUTH_TYPE = 'DISCORD_BOT_ISSUED_ACCESS_TOKEN'
378+
379+
def exchange_device_code_with_merge(device_code, external_auth_token):
353380
data = {
354381
'grant_type': 'urn:ietf:params:oauth:grant-type:device_code',
355382
'device_code': device_code,
@@ -366,7 +393,7 @@ def exchange_device_code_with_merge(device_code):
366393

367394
#### Merge Request Response
368395

369-
```python
396+
```json
370397
{
371398
"access_token": "<access token>",
372399
"token_type": "Bearer",
@@ -658,10 +685,11 @@ import {UserStatusIcon} from '/snippets/icons/UserStatusIcon.jsx'
658685

659686
## Change Log
660687

661-
| Date | Changes |
662-
|-------------------|---------------------------------------------|
663-
| February 25, 2026 | Clarify unmerge behavior and data migration |
664-
| March 17, 2025 | Initial release |
688+
| Date | Changes |
689+
|-------------------|--------------------------------------------------|
690+
| April 13, 2026 | Clarify Merging Provisional Accounts for Servers |
691+
| February 25, 2026 | Clarify unmerge behavior and data migration |
692+
| March 17, 2025 | Initial release |
665693

666694
{/* Autogenerated Reference Links */}
667695
[`Client::Authorize`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ace94a58e27545a933d79db32b387a468

0 commit comments

Comments
 (0)