2) Extract the files to the foundry installation directory.
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.
Either modify an existing application or create a new application.
4) Adding the Callback.
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.
5) Modify the discord.js script.
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 just id if you want to simplify adding new users.
6) Setting up the discord authentication in your browser.
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.)