MinecraftAuth.me

API documentation

Contents: Plugins and mods

Minecraft plugins and mods

The MinecraftAuth plugins and mods only let players join your server if they meet your conditions. For example, they can require players to follow you on Twitch, subscribe on YouTube, back you on Patreon or have a role in your Discord server. Players link their accounts once at minecraftauth.me. You don't write any code: the plugin runs the membership checks for you.

Downloads are on Modrinth. The source is in the integrations repository.

Platforms#

Platform Jar Checks players at
Spigot / Paper / Folia (1.16.5+) MinecraftAuth-Bukkit AsyncPlayerPreLoginEvent
Sponge (API 8+) MinecraftAuth-Sponge ServerSideConnectionEvent.Auth
Velocity MinecraftAuth-Velocity LoginEvent, and ServerPreConnectEvent for per-server rules
BungeeCord MinecraftAuth-BungeeCord LoginEvent, and ServerConnectEvent for per-server rules
Fabric 1.16.5, 1.18.2, 1.19.x, 1.20.1, 1.21.1, 1.21.11, 26.1+ MinecraftAuth-Fabric-<mc> login (PlayerList.canPlayerLogin)
Forge 1.16.5, 1.18.2, 1.19.2, 1.20.1 MinecraftAuth-Forge-<mc> login (PlayerList.canPlayerLogin)
NeoForge 1.21.1, 1.21.11, 26.1+ MinecraftAuth-Neoforge-<mc> login (PlayerList.canPlayerLogin)

There is one mod jar for each Minecraft version and loader. The 26.3 jar covers every version from 26.1 on. The Fabric jars need Fabric API. Every other jar is self-contained.

Setup#

  1. Put the jar in plugins/ (mods: mods/) and start the server once. This creates MinecraftAuth.yml (mods: config/minecraftauth/MinecraftAuth.yml).
  2. Create an application on the Developers page, then paste its ID and secret into api.application-id and api.application-secret. Membership checks run as you, the application's owner, so link the accounts you'll check against (your Twitch channel, your Discord account, ...) to your MinecraftAuth.me account. See Authentication.
  3. Pick your gatekeeper.conditions and run /minecraftauth reload (alias /mcauth).

Without an application ID and secret, the gatekeeper is off, and the console says so at startup. An older api.server-token still works until server tokens are retired, and the plugin logs a warning at startup.

Configuration#

api:
  application-id: ""
  application-secret: ""          # keep it private
  cache-seconds: 60               # how long a membership answer is remembered

gatekeeper:
  bypass:                         # players (UUIDs or names) who may always join
    - "069a79f4-44e9-4726-a5be-fca90e38aaf5"
    - "Notch"
  bypass-admins: true             # operators and minecraftauth.bypass holders skip the checks
  on-api-error: deny              # deny or allow when MinecraftAuth.me, Twitch, Discord, ... can't be reached

  messages:
    denied: "&cYou must be following me on Twitch to join!\n\n&7Already following? Link your accounts at &ehttps://minecraftauth.me"
    error: "&cWe couldn't check your linked accounts right now. Please try again in a minute."

  conditions:                     # any one of these lets a player in; an empty list turns the gatekeeper off
    - TwitchSubscriber(2)
    - DiscordRole("123456789012345678") and not(DiscordRole("987654321098765432", "Banned"))
    - PatreonMember("Gold")
Key Default
api.application-id, api.application-secret empty your application's credentials
api.cache-seconds 60 how long a membership answer is cached before MinecraftAuth.me is asked again
gatekeeper.bypass players who always get in, by UUID or name
gatekeeper.bypass-admins true let operators and players with minecraftauth.bypass in without checks (see Commands and permissions)
gatekeeper.on-api-error deny when a check can't be answered: deny keeps the player out with messages.error, allow lets them in. Misconfigured credentials (HTTP 400/401/403) always deny
gatekeeper.messages.denied the kick message when no condition is met. & color codes work
gatekeeper.messages.error the kick message when the check itself failed
gatekeeper.conditions TwitchFollower() who may join: see Conditions
gatekeeper.servers {} proxies only: rules for individual backend servers (see Proxies)

Conditions#

A player may join when any condition in the list is true.

Condition The player...
TwitchFollower() follows your Twitch channel
TwitchSubscriber() / TwitchSubscriber(2) subscribes on Twitch at any tier, or at tier 1-3 or higher
YouTubeSubscriber() subscribes to your YouTube channel
YouTubeMember() is a member of your YouTube channel
PatreonMember() / PatreonMember("Gold") is an active patron, optionally of that tier
DiscordServer("guild id") is in that Discord server
DiscordRole("role id") has that Discord role
DiscordRole("guild id", "role id or name") has that role in that Discord server
Linked() has linked their Minecraft account at all
Linked("discord") has also linked that platform (discord, twitch, patreon, google)

"Your" means the owner of the application. Combine conditions with and, or and not(...) (&& and || work too). Evaluation stops as soon as the answer is known.

For DiscordServer and DiscordRole, the MinecraftAuth bot must be in that Discord server, and the Discord account linked to your MinecraftAuth.me account must own the server or have the Administrator or Manage Messages permission there. A role name always needs the server's guild ID, because anyone can add the bot to their own server and create a role with the same name. DiscordRole("Subscriber") on its own is rejected when the config loads. Prefer the role ID anyway: a name stops matching when the role is renamed. To copy an ID, turn on Developer Mode in Discord (Settings > Advanced). Then right-click the role under Server Settings > Roles and choose "Copy Role ID", or right-click the server icon and choose "Copy Server ID".

Proxies#

On a Velocity or BungeeCord network, install MinecraftAuth on the proxy, not on the backend servers, and keep the proxy in online mode (online-mode = true in velocity.toml, online_mode: true in BungeeCord's config.yml).

Players link their real (Mojang) UUID. Backend servers behind a proxy run in offline mode, and without player-info forwarding they see offline UUIDs, which have never been linked, so a copy of MinecraftAuth there denies everyone. For the same reason, an offline-mode server or proxy can't use MinecraftAuth at all.

The proxy's config can also have rules for individual backend servers. Each server accepts the same keys as gatekeeper (conditions, messages, bypass). Anything left out uses the top-level value:

gatekeeper:
  conditions:
    - TwitchFollower()
  servers:
    event:
      conditions:
        - TwitchSubscriber(2)
      messages:
        denied: "&cThe event server is for tier 2+ Twitch subscribers only."

Bedrock players#

Floodgate gives Bedrock players their own UUIDs (00000000-0000-0000-...). MinecraftAuth.me only links Java accounts, so a Bedrock player never meets a condition and is denied with messages.denied. To let one in, do one of these:

  • Link their Bedrock account to a Java account with Floodgate's account linking, so they join with the Java UUID. Then have them link that Java account at minecraftauth.me.
  • Add their Floodgate UUID or name to gatekeeper.bypass. Floodgate puts a prefix (. by default) in front of Bedrock names, so the name has to include it, e.g. .SomePlayer.

No setting lets every Bedrock player in.

Commands and permissions#

Command Who can run it What it does
/minecraftauth (alias /mcauth) everyone shows the version and how many conditions are active, or that no credentials are set
/minecraftauth reload minecraftauth.reload re-reads MinecraftAuth.yml and clears the cached answers
Permission Spigot / Paper / Folia Velocity BungeeCord Sponge Fabric / Forge / NeoForge
minecraftauth.reload op by default from your permissions plugin from your permissions plugin or config.yml groups from your permissions plugin op level 3 (mods have no permission nodes)
minecraftauth.bypass yes, and operators always bypass yes, at login and when switching servers at login: only config.yml groups with this permission or *; when switching servers: any permissions plugin not supported, use gatekeeper.bypass not supported, but operators (any level) bypass

The console can always reload. minecraftauth.bypass and operator bypass only apply while bypass-admins is true.

On Spigot, Paper and Folia, the check still runs at pre-login for operators and permission holders, because a player has no permissions until they exist. The answer is ignored for them. BungeeCord hasn't loaded permissions plugins for a player at login either, which is why only the groups in its own config.yml count there.

Troubleshooting#

Which message did the player get? messages.denied means MinecraftAuth.me answered and none of the conditions passed. messages.error means the check itself failed. The console says the same: Denying <name>: none of the conditions are met, or ... their accounts couldn't be checked.

Everyone gets messages.error:

  • The application ID or secret is wrong, or the application belongs to a different account. The console shows MinecraftAuth.me rejected a check because of a configuration problem. Copy them again from the Developers page (rotate the secret if you lost it) and run /mcauth reload. A retired api.server-token gives the same error.
  • A DiscordServer or DiscordRole condition needs the bot in that server, and your linked Discord account must own or moderate it (see Conditions).
  • MinecraftAuth.me, Twitch, Discord, ... can't be reached and on-api-error is deny. The console shows Couldn't check '<condition>' for <name>. Set on-api-error: allow if you'd rather let players in during an outage.

Everyone gets messages.denied:

  • The player hasn't linked their Minecraft account at minecraftauth.me, or hasn't linked the platform the condition needs (Twitch for TwitchFollower(), Discord for DiscordRole(...), ...).
  • The server or proxy sees offline UUIDs. See Proxies.
  • The application belongs to a different account than the channel, Patreon campaign or Discord server you mean. Membership checks ask "does this player support the owner of this application?".

Nobody is checked at all: without api.application-id and api.application-secret, the gatekeeper is off. A condition that doesn't parse is skipped with Ignoring invalid condition '...', and if every condition is invalid, the gatekeeper is off too.

A change didn't take effect: run /mcauth reload. Answers are otherwise cached for api.cache-seconds, so a player who just followed or got a role may need to wait that long.

The first join is slow on a mod server: vanilla checks logins on the server thread, so a player's first check can hold up a tick until MinecraftAuth.me answers. Joins within api.cache-seconds after that are instant.

Upgrading from v1#

  • Replace the jar. Remove the old one first. Mods are now one jar per Minecraft version and loader (see Platforms).
  • Start from a fresh config. Move the old MinecraftAuth.yml aside, start the server once so the new file is written, then copy your conditions and bypass entries into it and add an application (see Setup). Mods now keep their config in config/minecraftauth/MinecraftAuth.yml.
  • Conditions keep working. DiscordRole("guild id", "role") works as before, and DiscordRole("role id") with just a role ID works too. A role name without its guild ID is rejected.