How to Create a Rank Management System using Glitch

Is anyone having this problem? I’ve tried for like 30 minutes but it fails.

Bad cookie.
Stored relog failed. Trying with given.
Error running server: Error: No cookie supplied and no cookie file available.
Stored relog failed. Trying with given.
Error: Did not receive X-CSRF-TOKEN
    at /rbd/pnpm-volume/57e3ff28-ee82-4cb2-9cab-afad3ab15817/node_modules/.registry.npmjs.org/noblox.js/4.3.0/node_modules/noblox.js/lib/util/getGeneralToken.js:26:15
    at tryCatcher (/rbd/pnpm-volume/57e3ff28-ee82-4cb2-9cab-afad3ab15817/node_modules/.registry.npmjs.org/bluebird/3.7.2/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/rbd/pnpm-volume/57e3ff28-ee82-4cb2-9cab-afad3ab15817/node_modules/.registry.npmjs.org/bluebird/3.7.2/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/rbd/pnpm-volume/57e3ff28-ee82-4cb2-9cab-afad3ab15817/node_modules/.registry.npmjs.org/bluebird/3.7.2/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/rbd/pnpm-volume/57e3ff28-ee82-4cb2-9cab-afad3ab15817/node_modules/.registry.npmjs.org/bluebird/3.7.2/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/rbd/pnpm-volume/57e3ff28-ee82-4cb2-9cab-afad3ab15817/node_modules/.registry.npmjs.org/bluebird/3.7.2/node_modules/bluebird/js/release/promise.js:729:18)
    at _drainQueueStep (/rbd/pnpm-volume/57e3ff28-ee82-4cb2-9cab-afad3ab15817/node_modules/.registry.npmjs.org/bluebird/3.7.2/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/rbd/pnpm-volume/57e3ff28-ee82-4cb2-9cab-afad3ab15817/node_modules/.registry.npmjs.org/bluebird/3.7.2/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/rbd/pnpm-volume/57e3ff28-ee82-4cb2-9cab-afad3ab15817/node_modules/.registry.npmjs.org/bluebird/3.7.2/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/rbd/pnpm-volume/57e3ff28-ee82-4cb2-9cab-afad3ab15817/node_modules/.registry.npmjs.org/bluebird/3.7.2/node_modules/bluebird/js/release/async.js:15:14)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
Error running server: Error: No cookie supplied and no cookie file available.```

I have no idea, still looking for a solution.

I get this when I visit the site:

And when I try to run a simple command in-game:

And, needless to say, it doesn’t post anything.

Also, the bot account always seems to be offline, not sure if that’s relevant.

Glitch no longer works with pinging projects so I don’t know how this will work anymore.

Edit: if you want to, you could buy Boosted Apps, but their expensive.

@BetaTrivus Someone helped me on this so I’m passing it along, in your package.json file you should change the noblox.js version to this:

  "name": "noblox.js-server",
  "version": "1.0.0",
  "description": "An example server that uses the noblox.js module.",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/Hamzah-z/noblox.js-server"
  },
  "author": "H_mzah <https://www.roblox.com/users/14398127/profile>",
  "license": "MIT",
  "dependencies": {
    "body-parser": "1.19.0",
    "express": "4.17.1",
    "express-validator": "^6.3.1",
    "noblox.js": "^4.6.3"
  },
  "bugs": {
    "url": "https://github.com/suufi/noblox.js-server/issues"
  },
  "homepage": "https://github.com/Hamzah-z/noblox.js-server"
}

Also, unless you purchase Glitch premium or keep the tab open and online, it won’t stay on 24’7.

2 Likes

Ok, I guess learn code (My app) will support bots :slight_smile:

Ugh

And I think Glitch should be used for static websites now, because glitch has bots being against their ToS.

No, I doubt very much that glitch won’t allow bots to be made with their services. I think that you are mistaken since the Glitch TOS Does mention:

You shouldn’t use bots or access our Services in malicious or un-permitted ways.

But, this does not mean bots hosted on the platform as Glitch glitch literally made a tutorial on how to make a discord bot.

Leme tell you about this, so Glitch permits bots, but not 24/7 hosting. Attempting to ping your project from a pinging website will end up in it being susupended or deleted. This was explained in their forms.

Oh, were you talking about this old thing?





I REALLY do not want my bot to go offline every five minutes, and I was talking about a bot in a certain situation.

A bot gets pinged by a person (or by a $10 Raspberry Pi)

Pinging is banned, and making a HTTP request might only just break that rule, in the result of a banned project.

This will get the project banned. ANY pinging service used will result in a suspended or deleted project. It happened to a big project yesterday. But, Glitch does allow boosted projects to be up 24/7 no ping with more resources. More info here. The problem is it is per-project. meaning that you have to boost certain projects. And due to people trying to bypass the ping ban, you now get 1000 hours each month for your entire account. They reset at the begining of each month. But the reason really does make since. They are making less money than they are losing.

1 Like

You won’t need it online 24/7. It turns on when it recives a request. Also, get a new cookie.

Your problem is you need a new cookie also. Change the API module to the newer one. You are sending the request to /GroupShout instead of /group/shout. In the newer module. you don’t need the group argument for example: lua print(api.promote(1).message).

@CAP7A1N How can I do this but with a normal VPS?

I tried downloading the rank management center things and application but neither work and says you don’t have an associated app ideas?

If I do every step here, then use repl.it instead, will I just have to put the repl.it URL instead of the glitch one?

It’s either you didn’t supply a valid cookie or even a cookie at all or your cookie has expired.

You’d have to use this Cookie Pool System and then get Glitch Premium. Then you must install the node-cron package and then add with the separate files with the cookie pool system on your Glitch project. and then enter this code on server.js after your current code in that file:


cron.schedule("* * * * *", () => {
  console.log("running a task at the start of every minute");
  //function logic goes here
  // Dependencies
  var parser = require("cheerio");

  // Define
  exports.func = function(args) {
    var $ = args.selector;
    if (!$) {
      $ = parser.load(args.html);
    }
    var inputs = {};
    var find = [
      "__VIEWSTATE",
      "__VIEWSTATEGENERATOR",
      "__EVENTVALIDATION",
      "__RequestVerificationToken"
    ];
    for (var i = 0; i < find.length; i++) {
      var get = find[i];
      inputs[get] = $("input[name=" + get + "]").val();
    }
    return inputs;
  };

  const no = require("./noblox.js");
  async function test() {
    await no.setCookie("Cookie");
    try {
      const t = await no.getGeneralToken();
      console.log(`Token, `, t);
    } catch (e) {
      console.error(`Failed: `, e);
    }
  }
  test();
  /**
   * Module used to reload a cookie
   */

  const request = require("request-promise");
  const getVerificationInputs = require("./getVerificationInputs").func;

  module.exports = {
    /**
     * Get the RequestVerificationToken
     *
     * @param {string} Cookie
     */
    getVerification: cookie => {
      return new Promise((resolve, reject) => {
        return request({
          url: "https://www.roblox.com/my/account#!/security",
          resolveWithFullResponse: true,
          headers: {
            cookie: `.ROBLOSECURITY=${cookie}`
          }
        }).then(res => {
          const inputs = getVerificationInputs({ html: res.body });
          var match;

          if (res.headers && res.headers["set-cookie"]) {
            match = res.headers["set-cookie"]
              .toString()
              .match(/__RequestVerificationToken=(.*?);/);
          }

          resolve({
            inputs: inputs,
            header: match && match[1]
          });
        });
      });
    },

    /**
     * Get the general token
     *
     * @param {string} Cookie
     */
    getGeneralToken: async cookie => {
      return new Promise((resolve, reject) => {
        return request({
          // This will never actually sign you out because an X-CSRF-TOKEN isn't provided, only received
          url: "https:////auth.roblox.com/v1/logout", // REQUIRES https. Thanks for letting me know, ROBLOX...
          resolveWithFullResponse: true,
          method: "POST",
          headers: {
            cookie: `.ROBLOSECURITY=${cookie}`
          }
        }).catch(res => {
          var xcsrf = res.response.headers["x-csrf-token"];
          if (xcsrf) {
            resolve(xcsrf);
          } else {
            reject("Did not receive X-CSRF-TOKEN");
          }
        });
      });
    },

    /**
     * Reload a cookie
     *
     * @param {string} Cookie
     */
    relog: cookie => {
      return new Promise(async (resolve, reject) => {
        if (!cookie) reject("no cookie supplied?");

        // Get verification token
        const verificationToken = await module.exports.getVerification(cookie);

        if (!verificationToken.header) return reject("Bad cookie");

        // Get general token
        const generalToken = await module.exports.getGeneralToken(cookie);
        // Refresh the token
        return request({
          url:
            "https://www.roblox.com/authentication/signoutfromallsessionsandreauthenticate",
          method: "POST",
          resolveWithFullResponse: true,
          headers: {
            "X-CSRF-TOKEN": generalToken,
            cookie: `.ROBLOSECURITY=${cookie}`
          },
          form: {
            __RequestVerificationToken:
              verificationToken.inputs.__RequestVerificationToken
          }
        })
          .then(res => {
            const cookies = res.headers["set-cookie"];

            if (cookies) {
              const newCookie = cookies
                .toString()
                .match(/\.ROBLOSECURITY=(.*?);/)[1];

              resolve(newCookie);
            } else {
              reject("Bad Roblox response");
            }
          })
          .catch(() => {
            reject("Bad Roblox response");
          });
      });
    }
  };
  rbx.refreshCookie(cookie);
});

Once that is done, please insert a valid cookie and then you are good. You should also replace cookieLogin with setCookie.

I hope this helps.

What * * * * is is for your cron job. It means every minute.

Don’t use repl.it. It is worst than glitch. Every “project” is open to the public. So there is no way to protect the cookie.

1 Like

unless you got the github student pack, and made a bunch of private repls. (they won’t expire)

2 Likes

It keeps saying
{“error”:“Server configuration error: Error: No cookie supplied and no cookie file available.”}

2 Likes