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

How can I refresh the accessToken via refreshToken? #11

Closed lovesmurf closed 1 year ago

lovesmurf commented 1 year ago

Is it possible to refresh this token via the steam-session package?

DoctorMcKay commented 1 year ago

It's not possible yet, but it's on my to-do list.

It's worth mentioning that access tokens are only useful when authenticating as a MobileApp and when using the access token against the WebAPI. Otherwise, access tokens aren't used for anything.

lovesmurf commented 1 year ago

It's not possible yet, but it's on my to-do list.

It's worth mentioning that access tokens are only useful when authenticating as a MobileApp and when using the access token against the WebAPI. Otherwise, access tokens aren't used for anything.

That is, if you log in through SteamClient token will last 200 days and I also through given me a cookie will be able to send requests during these 200 days?

DoctorMcKay commented 1 year ago

Refresh tokens issued via EAuthTokenPlatformType.SteamClient are valid for 200 days. As of yet, nobody has seen any way to refresh those tokens. I suspect that the official client will just make you reauth every 200 days.

You can get new web cookies anytime as long as you have a valid refresh token.

lovesmurf commented 1 year ago

Refresh tokens issued via EAuthTokenPlatformType.SteamClient are valid for 200 days. As of yet, nobody has seen any way to refresh those tokens. I suspect that the official client will just make you reauth every 200 days.

You can get new web cookies anytime as long as you have a valid refresh token.

How can I get new cookies with a refresh token? Tell me please

DoctorMcKay commented 1 year ago

Create a LoginSession object, assign your refresh token to the refreshToken property, and then call getWebCookies.

let session = new LoginSession(EAuthTokenPlatformType.SteamClient);
session.refreshToken = 'ey...';
let cookies = await session.getWebCookies();
DoctorMcKay commented 1 year ago

Access tokens can now be refreshed in 1.2.0.

https://github.com/DoctorMcKay/node-steam-session/releases/tag/v1.2.0