Skip to content

Commit 10a3778

Browse files
committed
tweaks
1 parent 3351896 commit 10a3778

File tree

1 file changed

+43
-16
lines changed

1 file changed

+43
-16
lines changed

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

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,22 @@ For existing Discord users who have added a provisional account as a game friend
6767

6868
---
6969

70-
## Choosing an Authentication Method
70+
## Getting Set Up
71+
### Choosing an Authentication Method
7172

72-
Discord offers a number of authentication methods tailored to different games:
73+
Discord offers a number of authentication methods, the one you use depends on how you game and account system is set up:
7374

74-
1. Use the [**Bot Token Endpoint**](/docs/discord-social-sdk/development-guides/using-provisional-acounts#bot-token-endpoint#) if your game has an account system which uniquely identifies users. This is the recommended approach when possible.
75-
2. Use the [**External Credentials Exchange Endpoint**](/docs/discord-social-sdk/development-guides/using-provisional-acounts#external-credentials-exchange-endpoint) if you have an existing OIDC provider, or do not have an account system.
76-
3. Use the [**Client Side Token Exchange Method**](/docs/discord-social-sdk/development-guides/using-provisional-acounts#provisional-account-authentication-for-public-clients) if you are using a Public Client.
75+
1. Use the [Bot Token Endpoint](/docs/discord-social-sdk/development-guides/using-provisional-accounts#bot-token-endpoint#) if your game has an account system which uniquely identifies users. This is the recommended approach when possible.
76+
2. Use the [External Credentials Exchange Endpoint](/docs/discord-social-sdk/development-guides/using-provisional-accounts#external-credentials-exchange-endpoint) if you have an existing OIDC provider, or do not have an account system.
77+
3. Use the [Client Side Token Exchange Method](/docs/discord-social-sdk/development-guides/using-provisional-accounts#provisional-account-authentication-for-public-clients) if you are using a Public Client.
7778

78-
If you are using the **External Credentials Exchange Endpoint** or **Client Side Token Exchange Method**, you must [configure you identity provider](/docs/discord-social-sdk/development-guides/using-provisional-acounts#configuring-your-identity-provider) before proceeding.
79+
If you are using (2) or (3), you must configure you identity provider before proceeding.
7980

80-
## Configuring Your Identity Provider
81+
### Configuring Your Identity Provider
82+
83+
:::warn
84+
If you are using the bot token endpoint, no configuration is required.
85+
:::
8186

8287
Open the Discord app for your game in the [Developer Portal](https://discord.com/developers/applications). Find the `External Auth` page under the `Discord Social SDK` section in the sidebar.
8388

@@ -90,9 +95,7 @@ We currently support the following provider types:
9095
- Epic Online Services (EOS)
9196
- Unity
9297

93-
If you are using the bot token endpoint, no configuration is required.
94-
95-
Which are represented in Discord's systems by the following types:
98+
Providers are represented in Discord's systems by the following types:
9699

97100
#### External Auth Types
98101

@@ -115,7 +118,7 @@ You provide external authentication and uniquely identifies the user, and Discor
115118

116119
- If there is no account associated with the identity, a new provisional account is created along with a new access token for the user.
117120
- If there is a provisional account associated with the identity, an access token is returned.
118-
- If there is an existing _full Discord account_ associated with the identity, the request is aborted (See [Error Handling](/docs/discord-social-sdk/development-guides/using-provisional-acounts#error-handling)).
121+
- If there is an existing _full Discord account_ associated with the identity, the request is aborted (See [Error Handling](/docs/discord-social-sdk/development-guides/using-provisional-accounts#error-handling)).
119122

120123
Once authentication is complete, you can use the access token as you would a full Discord user's access token.
121124

@@ -245,15 +248,14 @@ Common error codes and solutions for the server token exchange methods:
245248
If you are using OIDC, you may encounter more specific errors:
246249

247250
| Code | Meaning | Solution |
251+
|--------|-----------------------------------|-----------------------------------------------------------------------------|
248252
| 530002 | Invalid issuer | Verify the issuer in your ID token matches your configuration |
249253
| 530003 | Invalid audience | Check that the audience in your ID token matches your OIDC configuration |
250254
| 530008 | OIDC configuration not found | Verify your OIDC issuer URL is configured and accessible |
251255
| 530009 | OIDC JWKS not found | Check that your OIDC provider's JWKS endpoint is accessible |
252256
| 530020 | Invalid OIDC JWT token | Ensure your OIDC ID token is properly signed and formatted |
253257

254-
:::info
255258
You can find you OIDC configuration by visiting the [Developer Portal](https://discord.com/developers/applications), selecting your application, and opening the `External Auth` page under the `Discord Social SDK` section in the sidebar.
256-
:::
257259

258260
---
259261

@@ -291,11 +293,13 @@ client->UpdateProvisionalAccountDisplayName("CoolPlayer123", [](discordpp::Clien
291293

292294
When a player wants to convert their provisional account to a full Discord account, we start a special version of the [access token request flow](/docs/discord-social-sdk/development-guides/account-linking-with-discord#requesting-access-tokens) where the provisional users external identity is included.
293295

294-
- If you have a backend, follow [Merging Provisional Accounts for Servers](/docs/discord-social-sdk/development-guides/using-provisional-acounts#merging-provisional-accounts-for-servers)
295-
- If you do not have a backend, follow [Merging Provisional Accounts for Public Clients ](/docs/discord-social-sdk/development-guides/using-provisional-acounts#merging-provisional-accounts-for-public-clients)
296+
- If you have a backend, follow [Merging Provisional Accounts for Servers](/docs/discord-social-sdk/development-guides/using-provisional-accounts#merging-provisional-accounts-for-servers)
297+
- If you do not have a backend, follow [Merging Provisional Accounts for Public Clients ](/docs/discord-social-sdk/development-guides/using-provisional-accounts#merging-provisional-accounts-for-public-clients)
296298

297299
### Merging Provisional Accounts for Servers
298300

301+
Merging is as simple as including `external_auth_type` and `external_auth_token` in 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`.
302+
299303
#### Desktop & Mobile
300304

301305
```python
@@ -304,7 +308,7 @@ import requests
304308
API_ENDPOINT = 'https://discord.com/api/v10'
305309
CLIENT_ID = '332269999912132097'
306310
CLIENT_SECRET = '937it3ow87i4ery69876wqire'
307-
EXTERNAL_AUTH_TYPE = 'OIDC'
311+
EXTERNAL_AUTH_TYPE = 'OIDC' # See External Auth Types above
308312

309313
def exchange_code_with_merge(code, redirect_uri, external_auth_token):
310314
data = {
@@ -425,6 +429,19 @@ When a user merges their provisional account with a Discord account, the followi
425429
426430
This migration ensures users don't lose their social connections built while using the provisional account.
427431
432+
433+
### Merge Request Failures
434+
435+
You may receive a merge specific error code while attempting this operation:
436+
437+
| Code | HTTP Status | Meaning | Solution |
438+
|--------|-------------|--------------------------------------------|--------------------------------------------------------------------------- |
439+
| 530014 | 400 | Invalid merge source | The source account is not provisional |
440+
| 530016 | 400 | Invalid merge destination | The destination account is provisional |
441+
| 530017 | 400 | Merge source user banned | The provisional account being merged is banned from platform |
442+
| 530023 | 400 | Too many application identities | User already has an associated external identity for this application |
443+
| - | 423 | Resource locked | Transient error, wait and retry |
444+
428445
---
429446
430447
## Unmerging Provisional Accounts
@@ -552,6 +569,16 @@ When a user unmerges their account, a new provisional account is created with a
552569
Provisional accounts can have Discord friends, but can only message these friends when actively playing the game.
553570
:::
554571

572+
### Unmerge Request Failures
573+
574+
You may receive an unmerge specific error code while attempting this operation:
575+
576+
Code | HTTP Status | Meaning | Solution |
577+
|--------|-------------|--------------------------------------------|--------------------------------------------------------------------------|
578+
| 50229 | 400 | Invalid user type | User account is provisional and cannot be unmerged |
579+
| - | 404 | Unknown user | No user identity found for the provided external identity |
580+
581+
555582
---
556583

557584
## Next Steps

0 commit comments

Comments
 (0)