How to stop .ROBLOSECURITY Cookie from changing when logging onto account through Replit or Glitch

Hello All,
I’m trying to make a group rank bot which I control from in game by firing an HTTP request to my Replit code and I am using noblox on Replit to achieve this.

However, whenever I copy the cookie of the Bot account and put it into the Replit code, noblox says the code is invalid. I believe this is happening because of Roblox changing the cookie automatically as Replit is trying to log onto the account through a different IP then what I copied from.

Any help for ways to solve or overcome this is much appreciated.
Thanks!

Replit Code:

/*INSERT GROUP ID AND COOKIE BELOW*/

var groupId = 12345 // << Replace 12345 with your Group Id
var cookie = ""
/*INSERT GROUP ID AND COOKIE ABOVE*/


const express = require("express");
const rbx = require("noblox.js");
const app = express();

app.use(express.static("public"));

async function startApp() {
  await rbx.setCookie(cookie);
  let currentUser = await rbx.getCurrentUser();
  console.log(currentUser.UserName);
}
startApp();

app.get("/ranker", (req, res) => {
    var User = req.param("userid");
    var Rank = req.param("rank");
  
    rbx.setRank(groupId, parseInt(User), parseInt(Rank));
    res.json("Ranked!");
});

const listener = app.listen(process.env.PORT, () => {
  console.log("Your app is listening on port " + listener.address().port);
});
4 Likes

I remember every time I logged in/out to the account it changed. I used a incognito tab and closed it after grabbing the cookie

Tried that but still getting the error unfortunately

1 Like

You could request credentials every time the replit is started, as replits aren’t guaranteed to have your replit IP location in the same place every time.

You could also use Open-Cloud once it gains support for group api

2 Likes

How would I be able to request credentials when the replit is started? Could you ellaborate on what you mean by it and how it’ll work please :slight_smile:

I had this exact same issue. EXACT. No worries, a stranger on the internet told me a solution, and now you’ll have one tell you too.

So, once you log into/create the account, you’d copy the cookie, and then delete the cookie. Refresh. This will log you out without invalidating the cookie.

That can take around a minute, but it can be way faster if you used an extension.

I use EditThisCookie, which is a safe and verified extension.

You open the extension, and get greeted with this page:

Obviously, you’d then copy the cookie.

Then, simply, click this icon here:
image
You’re done. Refresh, and you should be logged out. This means the cookies cleared successfully. The cookie you have should not expire when this happens.

However, I’m not sure about the expire dates. I was told it was two years, ten years, just one year, or even a day, but I can tell you that they don’t expire quickly. It’ll take a good while, if it ever, did, expire. Which it might.

1 Like

I’m not super familiar with the roblox api that much, but in previous projects I’ve used the Authentication v2 API to get credentials. Link to docs

By the way, this error occurs when noblox has an invalid cookie, you should refresh them every login if you don’t already.

I’m still experiencing the same issue after replicating the steps exactly how you said. Maybe I’m doing something wrong that I’m not sure of. Would you be able to help any further?

Are you pasting the new cookie you copied into your code?

Yep I have. And I even tried to wait 5 minutes before using the cookie. It just still seems to be changing.

Oh, it’s in the post, my bad. Oops.

Here. I am hosting it on Replit

/*INSERT GROUP ID AND COOKIE BELOW*/

var groupId = 17006497 // << Replace 12345 with your Group Id
var cookie = "" //Cookie would paste here
/*INSERT GROUP ID AND COOKIE ABOVE*/


const express = require("express");
const rbx = require("noblox.js");
const app = express();

app.use(express.static("public"));

async function startApp() {
  await rbx.setCookie(cookie);
  let currentUser = await rbx.getCurrentUser();
  console.log(currentUser.UserName);
}
startApp();

app.get("/ranker", (req, res) => {
    var User = req.param("userid");
    var Rank = req.param("rank");
  
    rbx.setRank(groupId, parseInt(User), parseInt(Rank));
    res.json("Ranked!");
});

const listener = app.listen(process.env.PORT, () => {
  console.log("Your app is listening on port " + listener.address().port);
});

Maybe there’s some weird whitespace. I had that issue before. Maybe try adding
cookie = cookie.trim()
… underneath the cookie variable to trim whitespace.

Still no. :pensive:
Would you be able to perhaps guide me whilst I screenshare or something? I must be doing something wrong.

Sure. Lets take this into DMs.