HTTP Requests return 401 (Unauthorized)

Hi. As you’d have read as the title of this post, I’ve been trying for quite a while now to make different types of requests to the Discord API but I always end up getting these errors: HTTP 401 (Unauthorized).

local HTTPS = game:GetService('HttpService');

-- These are not actual values. Do not waste your time trying to use the Token, GuildID or ChannelID for whatever purpose.
local BotToken = '_1ax2qMddg_LVi_TkG5Qzp8dvMoLk7F7';
local GuildID = '1081329356006539356';
local ChannelID = '1132512832788877333';

local Link = 'https://discord.com/api/v9/guilds/' .. GuildID .. '/channels';
local Headers = {
        ['Authorization'] = 'Bot ' .. BotToken,
};

local Response = HTTPS:PostAsync(Link, '', Enum.HttpContentType.ApplicationUrlEncoded, false, Headers) -- Errors: HTTP 401 (Unauthorized).
print(Response);

Any clue on why my code is throwing this error?
Thanks in advance; any help is appreciated.

Discord has banned direct calls to its API, and you need to use a proxy set up, from what I’m aware of. :slight_smile: People spammed the API with audit logs and so they banned all roblox requests (due to people not respecting the rate limits)

Discord blocks HTTP requests from Roblox and has for a while. You’re gonna have to use a proxy or another form of server.

@OfficialPogCat; @Katrist: what’s the easiest way of doing this? - I’ve found some, like using Heroku or Cyclic.sh, but, before figuring out how to use them and working for hours on that, I wanted to ask if that’d be an efficient method or not.

Yep. Depending on your project to, if you don’t care about the privacy of your messaging there is also other public proxies that are for discord webhooks. But yes it is recommended you make it on your own using the apps you mentioned

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.