Lyumix Discord Auth

Lyumix Discord Auth

Mod

Server Side Mod for Authentication of Players via Discord

Server TechnologyUtility

38 downloads
2 followers
Follow Save
Host your Minecraft server on BisectHosting - get 25% off your first month with code MODRINTH.

Server-Side Mod for Player Authentication via Discord.

To apply your Discord bot API token, start the server once with the mod installed. After the initial startup, modify the bot-token field in the generated server-folder/config/lyumix-discord-auth/config.hocon file with your token.

Note: Currently, the mod only supports MongoDB for storing player data. If you don't have a dedicated MongoDB server, you can use a free database from the official MongoDB website.

Steps to Get MongoDB Connection String
  1. Sign up or log in to MongoDB Atlas:

    • Visit the MongoDB website and sign up for a free account, or log in if you already have one.
  2. Create a new cluster:

    • Once logged in, go to the Clusters section and click Create Cluster.
    • Follow the setup instructions to configure your cluster (e.g., choosing your preferred cloud provider, region, and any free-tier options).
  3. Create a MongoDB user:

    • Go to the Database Access tab under Security.
    • Click Add New Database User.
    • Choose a username and password for your database.
    • Make sure to select the appropriate role for your user (e.g., Read and Write to any Database).
    • Save the username and password for future use.
  4. (Optional) Whitelist your server IP address:

    • Go to the Network Access tab under Security.
    • Click Add IP Address and whitelist your server's IP address, or select Allow Access from Anywhere if you're not sure of the IP or want universal access.
  5. Get your connection string:

    • Once your cluster is created, click Connect on your cluster dashboard.
    • Choose Connect your application.
    • Copy the provided connection string. It should look like this:
      mongodb+srv://<username>:<password>@cluster0.mongodb.net/?retryWrites=true&w=majority&appName=<app-name>
      
    • Replace <username>, <password>, and <app-name> with the appropriate values:
      • <username>: Your MongoDB username.
      • <password>: Your MongoDB password (URL-encoded if necessary).
      • <app-name>: The name of your application (optional).
Steps to Create a Discord Bot and Get the API Token
  1. Log in to Discord Developer Portal:

  2. Create a new application:

    • Once logged in, click the New Application button.
    • Give your application a name (this will be the name of your bot) and click Create.
  3. Copy your bot's API token:

    • In the application's dashboard, navigate to the Bot section on the left-hand menu.
    • After setting up the bot, you'll see the bot's information, including the Token.
    • Important: You will not be able to see the token again after this point unless you reset it. If you need to access the token, click the Regenerate button next to the token to create a new one, which will reveal the new token.
    • Click the Copy button next to the Token field to save it for your mod configuration.

      Important: Keep this token secure! If someone else gets access to it, they can control your bot.

  4. Invite your bot to a server:

    • To add your bot to a server, go to the OAuth2 section in the left-hand menu.
    • Under OAuth2 > URL Generator, check the bot box in the Scopes section.
    • Scroll down to Bot Permissions and select Send Messages as the only permission your bot needs.
    • Copy the generated URL at the bottom, paste it in your browser, and select the server where you want to invite the bot.
User Guide: Minecraft Mod Authentication via Discord

First Login Process

  1. Join the Server:

    • When you join the server, the bot will automatically send you an auto-generated code in the game chat.
  2. Write the Registration Command:

    • Go to the specified Discord server (as indicated in the mod configuration).
    • In the server chat, type the command:
      /register <code>
      
      Replace <code> with the code you received from the bot in the game.
  3. Authorize Direct Messages (DMs) from the Bot:

    • Ensure that you have allowed messages from server members or send any message to the bot in a direct message (DM) to initiate communication.

Subsequent Logins

  1. Join the Server Again:

    • For any future logins, simply join the server as usual.
  2. Receive Confirmation Message:

    • After joining, the bot will send you a direct message on Discord to confirm your login.
  3. Approve or Reject the Login:

    • Respond to the bot’s message:
      • Type Approve to allow the login and gain access to the game.
      • Type Reject to deny access.

Important Notes

  • Keep Your Code Safe: Do not share your auto-generated code or any login details with anyone.
  • Allow Direct Messages: Make sure that you have allowed DMs from the bot, or simply send any message to the bot in a DM, for the system to function correctly.

Project members

MatterMoulder

Owner

Details

Licensed CC-BY-SA-4.0
Published a month ago
Updated 9 days ago