Ask coding questions

← Back to all posts
How can I fix HTTPError: Response code 401 (Unauthorized)
DustyIDK (0)

The code works fine when I run it, but whenever I DM the bot and the bot tries to get http://api.brainshop.ai/get?bid=${bid}&key=${key}&uid=${message.author.id}&msg=${text}, it returns the following error:

HTTPError: Response code 401 (Unauthorized)
    at Request.<anonymous> (/home/runner/TG/node_modules/got/dist/source/as-promise/index.js:117:42)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  code: undefined,
  timings: {
    start: 1625882240428,
    socket: 1625882240429,
    lookup: 1625882240437,
    connect: 1625882240460,
    secureConnect: undefined,
    upload: 1625882240460,
    response: 1625882242483,
    end: 1625882242490,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 1,
      dns: 8,
      tcp: 23,
      tls: undefined,
      request: 0,
      firstByte: 2023,
      download: 7,
      total: 2062
    }
  }
}

How can I fix it?

Comments
hotnewtop
Coder100 (18934)

Confirm that you actually have the correct credentials, and you actually logged in.