You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: developers/discord-social-sdk/development-guides/using-provisional-accounts.mdx
+37-9Lines changed: 37 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -313,17 +313,32 @@ If you are testing your merge integration, make sure to add your QA users to you
313
313
314
314
### Merging Provisional Accounts for Servers
315
315
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`.
|`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
+
320
334
```python
321
335
import requests
322
336
323
337
API_ENDPOINT='https://discord.com/api/v10'
324
338
CLIENT_ID='332269999912132097'
325
339
CLIENT_SECRET='937it3ow87i4ery69876wqire'
326
-
EXTERNAL_AUTH_TYPE='OIDC'# See External Auth Types above
340
+
# See External Auth Types above for all supported values
|`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
+
346
370
```python
347
371
import requests
372
+
348
373
API_ENDPOINT='https://discord.com/api/v10'
349
374
CLIENT_ID='332269999912132097'
350
375
CLIENT_SECRET='937it3ow87i4ery69876wqire'
351
-
EXTERNAL_AUTH_TYPE='OIDC'
352
-
defexchange_device_code_with_merge(device_code):
376
+
# See External Auth Types above for all supported values
0 commit comments