Background Information I am attempting to make a Group Auto Role Bot in Lua in Roblox Studio. Basically, if you meet certain requirements in a game the Bot Account will login to Roblox if not already logged in, and give the user the role in a group. I am using this API to do this, by the way.
The Issue When I send the Post Http Request (I’m using Frost’s Fixing HttpService Method), my script prints the status information “403 Forbidden 2” (2 is the reason, which is “You must pass the robot test before logging in.”). I read a devforum post that said you need the Cookie to login, however I don’t know how to get a cookie that constantly refreshes and can only be retrieved if you’re already authenticated, nor do I have any idea how to implement that.
Failed Fixes I’ve tried:
-- changing the API Version to v1
-- reading devforum posts that had similar problems to mine
-- diagnosing and fixing the problem by reading the Status Code Reason
My Script I just started on this project, so please do not expect it to look anywhere near finished or what I explained above.
local ProxyService = require(script.Parent.ProxyService)
local Proxy = ProxyService:New('https://blocked4securityreasons.herokuapp.com', 'blocked4securityreasons')
local Username = 'BotUsernameHere'
local Password = 'BotAccountPasswordHere'
local Token = nil
local http = game:GetService('HttpService')
local encode = http.JSONEncode
function getPost()
local Post = Proxy:Post('https://auth.roblox.com/v1/login', encode(http, {
ctype = 'Username',
cvalue = Username,
password = Password,
}), Enum.HttpContentType.ApplicationJson, false, {
['X-CSRF-TOKEN'] = Token
})
return Post
end
function attemptLogin(retry)
local Post = getPost()
if Post.status.code == 200 then
print('success')
else
if retry == false then
Token = Post.headers['x-csrf-token']
wait(3)
attemptLogin(true)
else
-- This just prints the status information when the Login Post Request fails
print(Post.status.code, Post.status.message, string.sub(Post.body, string.find(Post.body, 'code"') + 6, string.find(Post.body, 'code"') + 6))
end
end
end
attemptLogin(false)
I highly appreciate any help. Thanks.