|
| 1 | +--- |
| 2 | +sidebar_label: OAuth2 Scopes |
| 3 | +--- |
| 4 | + |
| 5 | +[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Core Concepts](/docs/discord-social-sdk/core-concepts) > {sidebar_label} |
| 6 | + |
| 7 | +# OAuth2 Scopes |
| 8 | + |
| 9 | +OAuth2 scopes define the level of access your app has to a user's Discord account |
| 10 | + |
| 11 | +What OAuth scopes are available to your integration are set via |
| 12 | +[`AuthorizationArgs::SetScopes`] on [`AuthorizationArgs`] which is passed to [`Client::Authorize`] on Social SDK |
| 13 | +authentication. |
| 14 | + |
| 15 | +## Default Presence Scopes |
| 16 | + |
| 17 | +At a minimum, the Social SDK uses the following scopes to use features like rich presence and friends list: |
| 18 | + |
| 19 | +- `openid` |
| 20 | +- `sdk.social_layer_presence` |
| 21 | + |
| 22 | +The default presence features include: |
| 23 | + |
| 24 | +* [Account Linking](/docs/discord-social-sdk/core-concepts/core-features#account-linking) |
| 25 | +* [Provisional Accounts](/docs/discord-social-sdk/core-concepts/core-features#provisional-accounts) |
| 26 | +* [Friend System & Relationships](/docs/discord-social-sdk/core-concepts/core-features#friend-system-relationships) |
| 27 | +* [Presence & Rich Presence](/docs/discord-social-sdk/core-concepts/core-features#presence-rich-presence) |
| 28 | + |
| 29 | +The Social SDK provides the helper method [`Client::GetDefaultPresenceScopes`], which returns `openid sdk.social_layer_presence`, |
| 30 | +that you can use when setting up your OAuth2 flow, for integrations that only need the above functionality. |
| 31 | + |
| 32 | +:::warn |
| 33 | +With only the default presence scopes, your game will not be able to use any of the limited access |
| 34 | +communications features. |
| 35 | +::: |
| 36 | + |
| 37 | +## Default Communication Scopes |
| 38 | + |
| 39 | +The communications features are currently available but have limited access. Those features **require** the scope |
| 40 | +of `sdk.social_layer`, which includes the `sdk.social_layer_presence` scope but also allows your app to use those limited features on behalf of the user. |
| 41 | + |
| 42 | +- `openid` |
| 43 | +- `sdk.social_layer` |
| 44 | + |
| 45 | +These communication features include: |
| 46 | +* [Messaging & Communication](/docs/discord-social-sdk/core-concepts/communication-features#messaging-communication) |
| 47 | +* [Lobbies & In-Game Chat](/docs/discord-social-sdk/core-concepts/communication-features#lobbies-ingame-chat) |
| 48 | +* [Linked Channels](/docs/discord-social-sdk/core-concepts/communication-features#linked-channels) |
| 49 | + |
| 50 | +The Social SDK provides the helper method [`Client::GetDefaultCommunicationScopes`], which returns `openid sdk.social_layer`, |
| 51 | +that you can use when setting up your OAuth2 flow, for integrations that integrates both the default and limited communications features. |
| 52 | + |
| 53 | +:::preview |
| 54 | +For more information about these features, please see [Core Concepts: Communication Features](/docs/discord-social-sdk/core-concepts/communication-features). |
| 55 | +::: |
| 56 | + |
| 57 | +If your game requires additional scopes, you can add them to the default scopes to authorize additional access from your users. |
| 58 | + |
| 59 | +You should only add scopes that are necessary for your game to function. Requesting unnecessary scopes can lead to user distrust and may result in users not linking their Discord account. |
| 60 | + |
| 61 | +See [available OAuth2 scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) available with the Discord API. |
| 62 | + |
| 63 | +## OAuth2 Client Types |
| 64 | + |
| 65 | +OAuth2 has two client types: **Public** and **Confidential**. Most games will not want to ship with **Public Client** enabled. |
| 66 | + |
| 67 | +Some Social SDK methods require your Discord application to be a **Public Client**. These methods also have server-side alternatives that you can use with a **Confidential Client**. |
| 68 | + |
| 69 | +- Public clients cannot securely store client secrets. |
| 70 | +- Using confidential clients with proper secret management for production applications is generally recommended. |
| 71 | +- Your security team should review this setting and authentication flows before releasing your game. |
| 72 | + |
| 73 | +[Learn more about OAuth2 client types](https://oauth.net/2/client-types) |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## Next Steps |
| 78 | + |
| 79 | +Start your integration, implement user authentication, and learn about UI design: |
| 80 | + |
| 81 | +<Container> |
| 82 | + <Card title="Getting Started" link="/docs/discord-social-sdk/getting-started" icon="PlayIcon"> |
| 83 | + Choose your platform and follow step-by-step setup instructions. |
| 84 | + </Card> |
| 85 | + <Card title="Account Linking" link="/docs/discord-social-sdk/development-guides/account-linking-with-discord" |
| 86 | + icon="LinkIcon"> |
| 87 | + Implement user authentication with Discord OAuth2. |
| 88 | + </Card> |
| 89 | + <Card title="Design Guidelines" link="/docs/discord-social-sdk/design-guidelines" icon="PaintPaletteIcon"> |
| 90 | + Learn how to design your game's UI to integrate social features. |
| 91 | + </Card> |
| 92 | +</Container> |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## Change Log |
| 97 | + |
| 98 | +| Date | Changes | |
| 99 | +|---------------|-----------------| |
| 100 | +| July 21, 2025 | initial release | |
| 101 | + |
| 102 | +{/* Autogenerated Reference Links */} |
| 103 | +[`AuthorizationArgs`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1AuthorizationArgs.html#adb47ac55258db29d4cb8a2c506093eed |
| 104 | +[`AuthorizationArgs::SetScopes`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1AuthorizationArgs.html#aa3714d11a196e0d71c8c1cf38c506d92 |
| 105 | +[`Client::Authorize`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ace94a58e27545a933d79db32b387a468 |
| 106 | +[`Client::GetDefaultCommunicationScopes`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a71499da752fbdc2d4326ae0fd36c0dd1 |
| 107 | +[`Client::GetDefaultPresenceScopes`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a7648bd1d2f7d9a86ebd0edb8bef12b5c |
0 commit comments