Jump to content
McKay Development

This refreshToken is not valid for logging in to the Steam client


Ryu

Recommended Posts

Quote
import SteamUser from 'steam-user';
import {LoginSession, EAuthTokenPlatformType} from 'steam-session';
let client = new SteamUser();
let session = new LoginSession(EAuthTokenPlatformType.WebBrowser);
const loginDetails = {
  accountName: "name",
  password: "pass",
  steamGuardCode: "2fa"
}
await session.startWithCredentials(loginDetails); 
session.on('authenticated', async () => {
  const logOnOptions = {
    "refreshToken": session.refreshToken
  };
  client.logOn(logOnOptions);
  client.on('loggedOn', (details) => {
    console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID());
  });
});

What am I doing wrong

Edited by Ryu
Link to comment
Share on other sites

#Logged into Steam
#Error not logged in

I'm trying to log into the bot with username, password and 2fa manually, save the refreshToken and cookies, and reuse them anytime I restart the bot.

client.logOn({"refreshToken": refreshToken });

client.on('loggedOn', async (details) => {
  console.log("Logged into Steam");

  let manager = new TradeOfferManager({
    "steam": client, 
    "domain": "example.com", 
    "language": "en" 
  });

  manager.setCookies(cookies, (err) => {
    manager.getInventoryContents(730, 2, true, (err, inventory) => {
      if (err) {
        console.log(err);
        return;
      }
  
      if (inventory.length == 0) {
        // Inventory empty
        console.log("CS:GO inventory is empty");
        return;
      }
  
      console.log("Found " + inventory.length + " CS:GO items");
    })
  
  })

});

 

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.

Guest
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.

Loading...
×
×
  • Create New...