Roblox Web API | Authentication

Okay, here’s my problem… I’m trying to create an npm package so people can create their own discord → roblox or website → roblox ranking bots. I’m trying to make it easier to use than noblox.js or any other nodejs package, and with better documentation. I’m having trouble making the authentication or login function, I’m getting errors such as “Token Validation Failed”, here is my code:

> const http = require("http");
> const request = require("request");
> const Promise = require("promise");
> const cookie = require("cookie");
> 
> module.exports.login = async function(cookie) {
> 
>   request.post("https://auth.roblox.com/v2/logout", {}, function(error, response, body) {
>     console.log(body);
>   });
> 
>   var options = {
>     method: 'POST',
>     url: "https://auth.roblox.com/",
>     headers: {
>       "Content-Type": "application/json",
>       "Cookie": cookie
>     }
>   }
> 
>   request(options, function(error, response, body){
>     console.log(body);
>   });
> 
> }
> 
> module.exports.getAudit = async function(groupid) {
>   return new Promise(function(resolve, reject) {
>     request("https://groups.roblox.com/v1/groups/"+groupid+"/audit-log", function(error, response, body){
>       if(error){
>         reject(error);
>       }
>       var parsedBody = JSON.parse(body);
>       resolve(parsedBody);
>     });
>   });
> }
> 
> module.exports.checkLogin = function() {
>   request("https://auth.roblox.com/", function(error, response, unparsedBody) {
>     var body = JSON.parse(unparsedBody)
>     console.log(body.message);
>   });
> }
> 
> module.exports.getGroupInfo = async function(groupid) {
>   return new Promise(function(resolve, reject){
>     request("http://api.roblox.com/groups/"+groupid+"/", function(error, response, body) {
>       if(error){
>         reject(error);
>       }
>       var parsedBody = JSON.parse(body);
>       resolve(parsedBody);
    >  });
 >   });
 > }
1 Like

https://gyazo.com/6d56599171ff2e43852e2f0e62b8e97e | Thats an image of the 2 errors I’m getting, the second error is for the logout.

1 Like

Somebody please help. (filler)

1 Like

I’m a little bit confused as to why you have a module called cookie and then reuse that variable name in the login function. Is this intentional? It may lead to situations where you confuse the two.

1 Like