node-minecraft-protocol icon indicating copy to clipboard operation
node-minecraft-protocol copied to clipboard

Error: Token does not exist

Open ia74 opened this issue 4 years ago • 1 comments

[X] The FAQ doesn't contain a resolution to my issue

Versions

  • minecraft-protocol: 1.20.2
  • server: paper 1.16.5
  • node: 15.6.0

Detailed description of a problem

A clear and concise description of what the problem is. When logging in with a packet relay proxy, auth.js will error out because a token does not exist.

Current code

const mc = require('minecraft-protocol');
const cfg_client = require("./cfg/client.json");
const cfg_server = require("./cfg/server.json");
const srv = mc.createServer({
    "online-mode": false,
    'port': cfg_server.port,
    'version': cfg_server.version
})

srv.on('login', (proxyclient) => {
    const client = mc.createClient({
        host: cfg_client.host,
        port: cfg_client.port,
        username: proxyclient.username,
        password: cfg_client.password,
        version: cfg_client.version,
        auth: 'mojang'
    });
    client.on('packet', (data, meta) => {
        proxyclient.write(meta.name, data);
    });
    proxyclient.on('packet', (data, meta) => {
        client.write(meta.name, data);
    });
})

Expected behavior

A clear and concise description of what you expected to happen. Client logs in, and packets starting being relayed to the proxy client.

Additional context

Add any other context about the problem here. Error from console:

/Users/le-microwave/Documents/proxy/node_modules/yggdrasil/lib/utils.js:60
      cb(new Error(body.errorMessage))
         ^

Error: Token does not exist
    at /Users/le-microwave/Documents/proxy/node_modules/yggdrasil/lib/utils.js:60:10
    at /Users/le-microwave/Documents/proxy/node_modules/phin/lib/phin.js:89:11
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
Emitted 'error' event on Client instance at:
    at cb (/Users/le-microwave/Documents/proxy/node_modules/minecraft-protocol/src/client/auth.js:97:16)
    at /Users/le-microwave/Documents/proxy/node_modules/minecraft-protocol/src/client/auth.js:154:17
    at /Users/le-microwave/Documents/proxy/node_modules/yggdrasil/lib/Client.js:60:7
    at /Users/le-microwave/Documents/proxy/node_modules/yggdrasil/lib/utils.js:27:7
    at /Users/le-microwave/Documents/proxy/node_modules/phin/lib/phin.js:91:11
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

ia74 avatar Feb 07 '21 22:02 ia74

Please provide the version of your node, npm and try to reinstall the minecraft-protocol package

you can get the versions by running npm -v node -v on the terminal

liquiddevelopmentnet avatar Dec 23 '21 14:12 liquiddevelopmentnet