Overview
This guide will walk you through integrating the Discord Social SDK into an Unreal Engine project. By the end, you’ll have a project that can:- Authenticate users with Discord
- Set up logging and status monitoring
- Start the SDK and establish a connection
- Request the number of Discord friends the player has
For the initial launch, the Unreal plugin has a name of 
DiscordPartnerSDK but this name will be changing to DiscordSocialSDK in a future versionPrerequisites
We are going to make a simple Unreal console application for this guide. Make sure you have the following prerequisites:- Windows
- Visual Studio 2022
- Unreal Engine 5.5
Step 1: Create a Discord Developer Team
Before you start, you’ll need to create a developer team on the Discord Developer Portal. This team will be used to manage your Discord applications and SDK integrations. If you already have a team configured, you can skip this step.- Create a developer team on the Discord Developer Portal.
Step 2: Create a Discord Application
- Create a new application on the Discord Developer Portal and assign it to your team.
- Add a redirect URL in the OAuth2tab:- For desktop applications: http://127.0.0.1/callback(this can be changed later).
- See discordpp::Client::Authorizefor more details on setting up more advanced redirect URIs.
 
- For desktop applications: 
- Enable the Public Clienttoggle in theOAuth2tab.
This guide requires enabling Public Client to allow you to get started with the SDK quickly. Most games will not want to ship as a public client. This setting should be reviewed by your team prior to releasing your game. Learn more about public clients.
Step 3: Enable Discord Social SDK for Your App
Once you’ve created your Discord application, you’ll need to enable the Discord Social SDK for it.- From the Discord Developer Portal, select your newly created application from Step 2.
- In the left sidebar for your app, locate and click the Getting Startedlink underDiscord Social SDK.
- Fill out the form to share details about your game.
- Click Submitand the Social SDK will be enabled for your application.
- Once enabled, you’ll find binaries for the Social SDK under Downloads.
Step 4: Download the Social SDK for Unreal Engine
- Click on the Downloadslink under the Discord Social SDK section of the sidebar.
- Select the latest version from the version dropdown and download the SDK for Unreal Engine.
A Unreal Engine sample project is available for download on this page, but we are not going to cover it in this guide. Explore it on your own after you finish this guide!
Step 5: Project Setup
Create a new Unreal Engine project
Select Third Person Unreal project (C++ language). We’ll set the project name toDiscordSocialUnreal.
The code samples below assume the project name is 
DiscordSocialUnreal. If you use a different name, make sure to replace it in the code.Add the Discord SDK to the project
Locate your Unreal project in the Windows file explorer. Create a new directory namedPlugins in the base of your project directory (DiscordSocialUnreal/Plugins).
Extract the Discord SDK archive in the Plugins directory. You should end up with a directory called DiscordPartnerSDK inside of Plugins DiscordSocialUnreal/Plugins/DiscordPartnerSDK.
Double check the name of the 
DiscordPartnerSDK folder once you’ve extracted it. It may change between versions and you’ll need to add the correct name in the code below.DiscordPartnerSDK plugin on launch.
Open Visual Studio from the Tools -> Open Visual Studio menu in Unreal Editor.
Open your DiscordSocialUnreal.Build.cs file located at /Source/DiscordSocialUnreal/ and add the following line after PublicDependencyModuleNames array:
Tools -> Refresh Visual Studio Project menu.
In the Unreal Editor, compile the code with Ctrl-Alt-F11. You should see a “Live coding succeeded” modal window if the compilation is successful.
Step 6: Initialize the SDK
In this section, we’ll add callbacks for logging and status of the SDK and OAuth2 authentication to support account linking with Discord. This process will:- Open the Discord app or a browser window for Discord login
- Get an authorization code
- Exchange it for an access token
- Connect to Discord
DiscordSocialUnrealCharacter.h in Visual Studio, where we start integrating the Social SDK!
DiscordLocalPlayerSubsystem
To use the Social SDK with Unreal Engine, we will need to include theDiscordLocalPlayerSubsystem which is responsible for managing the lifecycle of the client and executing the RunCallbacks event loop.
Add the following code to DiscordSocialUnrealCharacter.h:
DiscordSocialUnrealCharacter.h
DiscordSocialUnrealCharacter.h
DiscordSocialUnrealCharacter.cpp file.
In the DiscordSocialUnrealCharacter.cpp file, add the following code:
DiscordSocialUnrealCharacter.cpp
What’s Happening Here?
- We create a code verifier for OAuth2 PKCE security
- Set up authorization arguments with your app ID and required scopes
- Start the auth flow with Client::Authorize, which opens a browser
- When authorized, we exchange the code for an access token
- Client::UpdateTokentells the SDK to use our access token for Discord API calls
- Once the token is updated, we call Client::Connect, and the SDK will begin connecting asynchronously
Testing It Out
Save your changes in Visual Studio and return to Unreal Editor. Compile the code in Unreal Editor withCtrl-Alt-F11
Enter play mode and find the console at the bottom of Unreal Editor. Run DiscordConnect as a command to start the account linking process.
Most Discord features won’t work until the status is 
Ready. The status callback lets you know when you can start using them.Troubleshooting
- Double check your APPLICATION_IDis correct
- Ensure you’ve added the redirect URL in your Discord Developer Portal
- Check the output log for specific error messages
- Check that your access token is valid
- Ensure you have internet connectivity
Mac libdiscord_partner_sdk.dylib Not Opened
Mac libdiscord_partner_sdk.dylib Not Opened
On Mac you may get the error “libdiscord_partner_sdk.dylib” Not Opened because Apple couldn’t verify it. If this happens press Done on the popup.





Step 7: Access Discord Relationships
Let’s access the user’s Discord relationships (friends list) and display the count. This will help you understand how to access and use Discord data in your game. Add this code to theReady section of OnStatusChanged:
What This Code Does
Now, when the client status isReady, we’ll call Client::GetRelationships, returning us a list of all the player’s friends. We then log the number of friends directly to the output log.
Testing It Out
Save your changes in Visual Studio and return to Unreal Editor. Compile the code in Unreal Editor withCtrl-Alt-F11
Enter play mode, and find the console at the bottom of Unreal Editor, run DiscordConnect.
Example Output
Troubleshooting
- Verify your OAuth2 scopes include relationships access
- Ensure you’re connected (status is Ready)
- Check that you have friends on Discord
- Look for errors in the output log
Step 8: Set Rich Presence
Let’s show your game’s activity on Discord using Rich Presence. This feature lets players see what others are doing in your game directly in their Discord friends list. Add this code to theReady section of OnStatusChanged:
What This Code Does
- Creates an Activityobject to represent what the player is doing
- Sets basic information like:
- The activity type (Playing)
- Current state (“In Competitive Match”)
- Additional details (“Rank: Diamond II”)
- Updates your rich presence on Discord
Testing It Out
Save your changes in Visual Studio and return to Unreal Editor. Compile the code in Unreal Editor withCtrl-Alt-F11
Enter play mode and find the console at the bottom of Unreal Editor. Run DiscordConnect.
Once the OAuth flow is complete, the output log will tell you if setting rich presence was successful, and you can check your Discord profile to see it!
Troubleshooting
If you don’t see your presence:- Ensure you’re connected (status is Ready)
- Check the output log for error messages
- Verify your activity settings are valid
- Make sure you’re not invisible on Discord
The full DiscordSocialUnreal.Build.cs
The full DiscordSocialUnreal.Build.cs
The full DiscordSocialUnrealCharacter.cpp
The full DiscordSocialUnrealCharacter.cpp
The full DiscordSocialUnrealCharacter.h
The full DiscordSocialUnrealCharacter.h
Conclusion
Congratulations! You’ve successfully integrated the Discord Social SDK into your C++ application. Let’s review what you’ve accomplished:What You’ve Built
- ✅ Created a Discord application and configured OAuth2
- ✅ Set up SDK logging and status monitoring
- ✅ Implemented user authentication flow
- ✅ Retrieved Discord relationships data
- ✅ Added Rich Presence support
Key Concepts Learned
- How to initialize and configure the Discord SDK
- Managing authentication and connections
- Working with Discord’s social features
- Handling asynchronous callbacks
- Monitoring SDK status and events
Next Steps
You have successfully set up the Discord Social SDK with Unreal Engine and authenticated with Discord! You can now use the SDK to add more social features in your project.Creating a Unified Friends List
Create a unified friends list combining Discord and game-specific friendships
Setting Rich Presence
Customize your game’s rich presence to show more advanced information and game invites
Managing Game Invites
Allow players to invite friends to join their game session or party.
#social-sdk-dev-help channel for support from the community.
If you encounter a bug while working with the Social SDK, please report it here:  https://dis.gd/social-sdk-bug-report
Change Log
| Date | Changes | 
|---|---|
| March 17, 2025 | initial release |