Jump to content
McKay Development

globaloffensive : accountData is undefined


Recommended Posts


I am new to node and so my problem is that I cannot print accountData to console, it says it's undefined.

I read in the docs that the object exists when the "accountData" event is emitted, so here's what I did

const SteamUser = require('steam-user');
const GlobalOffensive = require('globaloffensive');

let user = new SteamUser();
let csgo = new GlobalOffensive(user);

const logOnOptions = {
    accountName: <Hidden>, // Consider these as valid credentials
    password: <Hidden>


user.on('loggedOn', () => {
    console.log('Connected to Steam!');
    csgo.on('connectedToGC', () => {
        console.log('Connected to GC!');
        csgo.on('accountData', () => {

And this is what I get :



What am I doing wrong ?

Thanks in advance !

Link to comment
Share on other sites

20 minutes ago, Dr. McKay said:

Sorry, the docs are unclear on this. You want to do this:

csgo.on('accountData', (accountData) => {

The accountData property only gets set after all accountData event listeners have returned.

Thanks for the answer ! It's working but for some reason it only works once per account, when i run my app.js again with the same account, accountData doesn't show up.

Maybe i'm not logging off properly before exiting ?

Link to comment
Share on other sites

11 hours ago, Dr. McKay said:

The GC can get confused if you disconnect. It may work better for you if you quit CS:GO with gamesPlayed([]), wait 5 seconds or so, then log off.

I'll try that thanks !


Edited by Rzn
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...