Skip to content

Session is not persistent between restarts longer than ~2hrs #40

@osztenkurden

Description

@osztenkurden

Describe the bug

Even with using Steam Guard Machine Token, log in fails and requires code from email

Versions

Node 20.9
steam-session ^1.7.2
I've recently updated from 0.0.4-alpha, which worked fine for the time being

Screenshots and Error Logs

const machineTokenPath = path.join(__dirname, './machinetoken');

const getMachineToken = () => {
    try {
        const content = fs.readFileSync(machineTokenPath, 'utf-8');
        return content;
    } catch {
        return null;
    }
}

const machineToken = getMachineToken();

if(!machineToken) console.log("No machine token");

export const session = new LoginSession(EAuthTokenPlatformType.SteamClient);

session.loginTimeout = 120_000;

session.on("steamGuardMachineToken", () => {
    if (session.steamGuardMachineToken) fs.writeFileSync(machineTokenPath, session.steamGuardMachineToken, 'utf-8');
});

session.startWithCredentials({
    accountName: env.ACCOUNT_NAME,
    password: env.PASSWORD,
    steamGuardMachineToken: machineToken || undefined
}).then(result => {
    if (result.actionRequired) {
        logger.warn("AUTH FAILED ACTION REQUIRED");
    }
}).catch((e) => {
    logger.error("Login failed", e);
});

I have another handler, where I can input 2FA code through http request. When I input that, user logs in and machine token saves on disk. If I restart it imidiately, it logs in, but when I restart it around 2hrs later, it requires 2FA code again. When using 0.0.4 up to today, it worked and logged all the time, even after restarting after days of uptime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions