sentanos / roblox-js

!!!THIS PROJECT IS NO LONGER MAINTAINED!!! Execute ROBLOX website actions in node.js
MIT License
45 stars 45 forks source link

ROBLOX returns 302 statuscode, roblox-js expects statuscode 200 #58

Closed bram1253 closed 6 years ago

bram1253 commented 6 years ago

Code:

var rbx = require('roblox-js');

rbx.login("Username", "Password")
.then(function(){
  rbx.follow(23701121);
});

Error:

Unhandled rejection Error: Follow failed
    at C:\Users\user\Desktop\NodeJS\node_modules\roblox-js\lib\user\follow.js:33:13
    at tryCatcher (C:\Users\user\Desktop\NodeJS\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\Users\user\Desktop\NodeJS\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (C:\Users\user\Desktop\NodeJS\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (C:\Users\user\Desktop\NodeJS\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (C:\Users\user\Desktop\NodeJS\node_modules\bluebird\js\release\promise.js:693:18)
    at Async._drainQueue (C:\Users\user\Desktop\NodeJS\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (C:\Users\user\Desktop\NodeJS\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (C:\Users\user\Desktop\NodeJS\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:666:20)
    at tryOnImmediate (timers.js:639:5)
    at processImmediate [as _immediateCallback] (timers.js:611:5)

After checking what causes this I found out that the following if statement was not return true: if (res.statusCode === 200) {

After printing out the statusCode I found out that ROBLOX is actually returning statuscode 302 when statuscode 200 is expected.

sentanos commented 6 years ago

ROBLOX will redirect you to an error page if for some reason your follow request fails. When you log in to the account manually and try to follow the person does it work?

bram1253 commented 6 years ago

Just tried and it gave me a captcha. After solving the captcha the NodeJS code worked perfectly...

sentanos commented 6 years ago

Ok then the problem here is ROBLOX is now adding captchas even to following in order to prevent bots. If you use following frequently you will continue to get these errors and have no way to get around them. Consider what you are doing, ROBLOX will only put captcha on things it doesn’t want people to bot.