DoctorMcKay / node-steam-session

Node.js module for authenticating with the Steam auth server. Allows for generating refresh tokens and web auth cookies for use with steam-user and other packages.
https://www.npmjs.com/package/steam-session
MIT License
112 stars 20 forks source link

[WebBrowser] - new_guard_data empty in PollAuthSessionStatus #8

Closed akuma0 closed 1 year ago

akuma0 commented 1 year ago

Hi! When i log-in, in PollAuthSessionStatus result, i got access_token & refresh_token but no new_guard_data. That's normal ? new_guard_data is maybe available only in SteamClient platform login ? If yes, do you plan a mechanic to refresh login when the steamLoginSecure expire ?

Thank you in advance for your answer!

DoctorMcKay commented 1 year ago

new_guard_data is only relevant for the SteamClient platform type, correct.

Getting a Steam Guard token for the WebBrowser platform type is only possible when logging out, which isn't presently implemented.

akuma0 commented 1 year ago

Ho, ok! I will look for a way to refresh the steamLoginSecure token automatically because he expires approximately about 24 hours.

DoctorMcKay commented 1 year ago

You can call getWebCookies() multiple times. Calling it when your login token expires would be a good way to refresh it.

If you don't still have your original LoginSession object but you do have a refresh token, you can create a new LoginSession, assign your refresh token to the refreshToken property, then call getWebCookies().

Example:

import {LoginSession, EAuthTokenPlatformType} from 'steam-session';

let session = new LoginSession(EAuthTokenPlatformType.WebBrowser);
session.refreshToken = 'token';
let cookies = await session.getWebCookies();
akuma0 commented 1 year ago

That's was i've done yesterday, it's works. Calling jwt/finalizelogin with refreshToken + steamId Then call all transfer_info to get the steamLoginSecure (same process than classic login)

Thank you !