Jump to content


Photo
Discussion

Error: Not Logged In at SteamCommunity._checkHttpErro

node.js node-steamcommunity

  • Please log in to reply
11 replies to this topic

#1 mrlon

mrlon

    Newbie

  • Member
  • Pip
  • 7 posts

Posted 17 February 2019 - 09:53 PM

HI, I wanna try to edit my profile name

function setupProfile(username) {
    community.editProfile({
        'name' 		: username,
    }, function(err) {
        if (err) {
            console.log('Failed to Edit Profile');
            console.log(err);
        }
    });
}

but I got this error

Failed to Edit Profile
Error: Not Logged In
    at SteamCommunity._checkHttpError (E:\new\steambot\node_modules\steamcommunity\components\http.js:95:9)
    at Request._callback (E:\new\steambot\node_modules\steamcommunity\components\http.js:50:61)
    at Request.self.callback (E:\new\steambot\node_modules\request\request.js:185:22)
    at Request.emit (events.js:182:13)
    at Request.<anonymous> (E:\new\steambot\node_modules\request\request.js:1161:10)
    at Request.emit (events.js:182:13)
    at Gunzip.<anonymous> (E:\new\steambot\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:273:13)
    at Gunzip.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1094:12)

as you can see that give me error Not Logged In but u can see my screenshot  I already login to account,please help

 

 

Attached Files



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,992 posts

Posted 18 February 2019 - 10:33 PM

I'm not sure whether this would cause the issue you're describing or not, but is your Steam profile set up yet? I only ask due to the name of your function.



#3 mrlon

mrlon

    Newbie

  • Member
  • Pip
  • 7 posts

Posted 19 February 2019 - 12:26 AM

I already do manual setup to my profile name, I already try everything like realName,summary,country,state,city,customURL,background get same error, Error: Not Logged I

user.on('loggedOn', () => {
user.setPersona(SteamUser.EPersonaState.Online);
console.log("Logged on!");
user.gamesPlayed(730);
user.emit("friendsList");
setupProfile("newname");
 
});
 


#4 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,992 posts

Posted 19 February 2019 - 04:02 AM

You aren't logged into Steam Community until webSession fires.



#5 mrlon

mrlon

    Newbie

  • Member
  • Pip
  • 7 posts

Posted 19 February 2019 - 07:54 AM

so i need to put

setupProfile("newname");

inside

user.on('webSession', (sessionid, cookies) => {
community.setCookies(cookies);
setupProfile("newname");
});

 ?

but I get error

 cookies.forEach((cookie) => {
                ^
TypeError: Cannot read property 'forEach' of undefined

 

so how to make im loggedon comunity?



#6 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,992 posts

Posted 19 February 2019 - 10:50 PM

That code looks correct. You're obviously doing something else wrong, but I can't tell you what without seeing more code (and a full stack trace).



#7 mrlon

mrlon

    Newbie

  • Member
  • Pip
  • 7 posts

Posted 20 February 2019 - 12:20 AM

here my full code

 

var username;
var password;
var Steam = require("steam");
var steamCode;
var SteamCommunity = require('steamcommunity');
var community = new SteamCommunity();
var fs = require("fs");
var SteamUser = require('steam-user');
var readline = require("readline");
var LineByLineReader = require('line-by-line'),
var user = new SteamUser();
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
 
user.on('steamGuard', function(domain, callback) {
console.log("oops we need steam guard");
 
rl.resume();
rl.question("enter SteamGuard code: ", function(answer) {
     steamCode = answer;
     rl.pause();
     callback(steamCode);
});
});
user.on('webSession', (sessionid, cookies) => {
community.setCookies(cookies);/*got error E:\new\steambot\node_modules\steamcommunity\index.js:296
        cookies.forEach((cookie) => {
                ^

TypeError: Cannot read property 'forEach' of undefined*/
setupProfile("its a name");//got Error: Not Logged In at SteamCommunity._checkHttpError (E:\new\steambot\node_modules\steamcommunity\components\http.js:95:9)
});
user.on('loggedOn', () => {
user.setPersona(SteamUser.EPersonaState.Online);
console.log("Logged on!");
user.gamesPlayed(730);
user.emit("friendsList");
user.emit("webSession");
 
});

user.on("friendsList", function() {
for (var steamid64 in user.myFriends) {
var relationship = user.myFriends[steamid64];
if (relationship == SteamUser.EFriendRelationship.RequestRecipient) {
addFriend(steamid64);
console.log("we just add frind" + steamid64);
 
}
}
});
function addFriend(steamID)
{
user.addFriend(steamID);
}
function setupProfile(username) {
community.editProfile({
'name'      : username,
}, function(err) {
if (err) {
console.log('Failed to Edit Profile');
console.log(err);
}
});
}
 
 


#8 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,992 posts

Posted 20 February 2019 - 12:52 AM

user.emit("friendsList");

user.emit("webSession");

 

well-there-is-your-problem-right-there.j



#9 mrlon

mrlon

    Newbie

  • Member
  • Pip
  • 7 posts

Posted 20 February 2019 - 01:39 AM

what wrong with that? sry I really dont know,its work fine for adding friend when login



#10 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,992 posts

Posted 20 February 2019 - 02:33 PM

You should never call emit on a SteamUser instance yourself. Events are emitted by the module.



#11 mrlon

mrlon

    Newbie

  • Member
  • Pip
  • 7 posts

Posted 21 February 2019 - 01:45 AM

thanks solved



#12 creditc0dee

creditc0dee

    Newbie

  • Member
  • Pip
  • 3 posts
  • LocationAustria

Posted 04 March 2019 - 10:07 AM

Code is fine, but for a reason the whole profile gets set back again. So is there a better way then this one? 







Also tagged with one or more of these keywords: Discussion, node.js, node-steamcommunity

2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users