35
How to add Discord Authentication to FoundryVTT
- Navigate to github.com/mbround18/foundryvtt-discord-auth.
- Click on the green code button:
- Click Download as zip
Either with a gui client such as 7zip or with terminal, extract the files to the path/to/foundry/resources/app
directory. (where the main.js
file is located)
Depending on what client you are using, it will ask to overwrite the main.hbs
file. This is acceptable as the only modification to the original file is to load the discord script.
- Navigate to discord developers section
- Log into your discord account if needed.
- Either modify an existing application or create a new application.
- Click the OAuth2 tab under your application
- Click the Add Redirect button and add your foundrys url with
/join
at the end of it. - Click the save button.
- While on your discord applications page, copy the application ID.
- Now open and edit the file
public/scripts/discord.js
If you are using the application for windows, mac, Linux, etc it might be under path/to/foundry/resources/app/public/scripts/discord.js
- At the top of the file you will see the following configuration:
- Change the client ID to the one you have stored in your clipboard.
- Change the callback URL to match the one you saved in the redirects section on the discord developer portal.
- (Optional) You can choose to use
id, email
or justid
if you want to simplify adding new users.
- Navigate to your Foundry url.
- Launch your world.
- Log in as Gamemaster or your GM account.
- Navigate to the user management screen
- You will now see several new fields, change the User Name to be your discord username. (If you click on your username in the discord application it will copy it to clipboard.)
- Set the discord ID to be your Discord ID. (You can get this by following this guide)
- Add the email for yourself.
- Set the access key.
- (Optional) Repeat steps 5 through 8 for each user.
- Click Save and Return
If you opted to only use Discord ID or Email, your form will look different.
- Click the Log in with Discord button
- Authorize the application.
- Enter your access key.
- Enter your access key.
35