How to Create a Rank Management System using Glitch

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.”}

1 Like

@CityApes

Your cookies have most likely expired.
In order to get a new cookie, just follow Part 3 of the tutorial again.

I’ve gotten the cookie several times, and it keeps showing the same error.

HELP!

The only solution I can think of would be to get the cookie again.
Also, if there’s a file named “cookie” try deleting that and re-entering the cookie into the configuration file.

Oh my god, thank you!!

That worked! I was stuck for almost an hour, thanks!!

1 Like

I have private repls, that’s why I asked before.

@ChillingSystem How would I got about hosting this on my VPS?

Error running server: Error: No cookie supplied and no cookie file available.

Im getting a new error. P0lease could you update the code? Many thanks.

1 Like

I’m having this issue: Its giving me this error in roblox studio
image
I’m sure that I copied everything correctly so I have no clue what the issue could be.

5XX errors are from the server, which in this case is Glitch. Check your site to make sure it is working correctly.

1 Like

Which is the case for my site, image
I also checked the log on the glitch project but that wasn’t very useful to me.

EDIT: Turns out that the package.json file needed an update, and now everything is working correctly