Skip to content

bot get kicked unverifed username #3591

@ccmsh

Description

@ccmsh
  • The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 4.0.0
  • server: paper 1.20.4
  • node: 18.0.0

Detailed description of a problem

The bot shows Bot is ready! undefined when using Microsoft authentication, and after connecting to the server, it kicks with the error Kicked {"translate":"multiplayer.disconnect.unverified_username"}. It seems there is an issue with Microsoft account authentication.

I am trying to use mineflayer to connect a bot to a Minecraft server. The bot is configured to use Microsoft authentication, with the username and port set through environment variables.

What did you try yet?

  1. Verified that the Microsoft account credentials are correct.
  2. Confirmed that the server supports Microsoft account authentication.
  3. Tried adjusting the server's offline mode setting, but the issue persists.

Your current code

require("dotenv").config();
const { mineflayer: mineflayerViewer } = require("prismarine-viewer");
const mineflayer = require("mineflayer");
const { GoogleGenerativeAI } = require("@google/generative-ai");
const genAI = new GoogleGenerativeAI(process.env.GeminiToken);
async function say(_prompt) {
  const model = genAI.getGenerativeModel({ model: "gemini-pro" });
  const prompt = _prompt;
  const result = await model.generateContent({ prompt });
  const response = result.response;
  const text = response.text();
  return text;
}

const bot = mineflayer.createBot({
    host: process.env.MC_HOST || "###.###.####",       
    port: parseInt(process.env.MC_PORT) || 25565,   
    auth: "microsoft",
    username: process.env.MC_USERNAME || "###################", 
    version: process.env.MC_VERSION || "1.20.4",    
});

let target = null;
console.log(`Bot is ready! ${bot.username}`);
...

Expected behavior

The bot should log in successfully with the Microsoft account and display Bot is ready! <username>.
After connecting to the server, the bot should function without errors.

Additional context

It seems there is an issue with Microsoft account authentication, but I can't find a solution. Is there something I missed in the mineflayer configuration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stage1just created by someone new to the project, we don't know yet if it deserves an implementation / a fpossible bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions