Authentication
Learn more about Discord Authentication
Introduction
Using discord as authentication layer, is fairly simple. There're a few simple steps to integrate this nice feature into your gamemode.
Keep in mind, authentication with Discord, has nothing to do with a whitelist or something. It only checks if the user owns a Discord Account with valid credentials.
Installation
Step 1
Go to https://discord.com/developers/applications and create an account and application if you don't already have one.
Step 2
Visit the OAuth2 Page and store the Client ID and Client Secret inside your .env
Setup the redirect URL and press save.
This URL must be set inside .env
under DISCORD_REDIRECT_URL
too.
That's all for Setup. The Framework does the rest for you.
Example Usage
This is a simple integration inside the connection process for your gamemode. You must be familiar with the setup. This example does not explain the very basic part for creating components. Only the needed components. Any kind of code can be modified to fit your own needs.
This section describes the usage of our products on each side. This means our framework for server/client and our CEF implementation with svelte. If you have a different setup on CEF side, you can port the Svelte part to your preferred solution.
Keep in mind, this is only an example. The player properties for discordToken, pendingLogin, tokenData and discord does not exists inside framework or starter-template. You must extend the player by yourself.
Server
This is the Server side integration for Discord authentication
Client
Client side integration for Discord authentication
Gui/CEF
This implementation is only a very basic setup. No styles, no layouts.
Congrats you have now successfully setup Discord authentication.
Last updated