Jump to content
McKay Development

Dr. McKay

Administrator
  • Posts

    3398
  • Joined

  • Last visited

Posts posted by Dr. McKay

  1. 19 hours ago, Terry said:

    It doesn't work to get the refreshed cookie steamLoginSecure for checkout.steampowered.com .  If logged in by username , password and sharedsecret. it works.

    But it worked for both methods 2 days ago. 

    Env

    node v20.8.1,  npm 10.1.0

    image.png.c76fd7065631995c702e8877cc6a550a.png

    Works fine for me.

    17 hours ago, gud said:

    ...

    I'm not going to provide support for automated abuse reporting.

  2. 3 hours ago, Terry said:

    Sir, looks like the domain checkout.steampowered.com cannot use the steamLoginSecure cookie for a long time since yesterday's update. Is there any way to keep the login status for this domain?

    Works fine for me.

    1 hour ago, gud said:

    I tried using steam-user and httpRequestPost still returns the same error as before?

    I'm using the cookies and session id from steam-user in the headers I am passing

     

                            const user = new SteamUser({
                                httpProxy: proxyString
                            });
    
    			user.logOn({
                                accountName: String(logOnOptions.accountName),
                                password: String(logOnOptions.password)
                            });
    
    			user.on('loggedOn', function() {
                            	user.on('webSession', (sessionID, cookies) => {
                                		community.httpRequestPost('https://steamcommunity.com/actions/ReportAbuse/', {
                                        		form: { sessionid: sessionID, json: 1, abuseID: steam_id, eAbuseType: 14, abuseDescription: 					hijackQuotes[randomIndex], ingameAppID: '' },
                                        		headers: { Cookie: cookies, Host: 'steamcommunity.com', Origin: 'https://steamcommunity.com' },
                                        		json: true
                                    }, (err, response, body) => {
                                       //Here body returns: You must be logged in to perform that action
                                       //And err returns "HTTP error 401"
                                    }, "steamcommunity");
                                });
                            });

     

    Why are you doing all that and not just calling community.setCookies()?

  3. 11 hours ago, 4049_1572836826 said:

    Hi, I got my hands on a new refreshroken which brings back store.steam ... but when I put it into steam-user it error me on validation :(

    This is expected behavior. You can only use a token generated with EAuthTokenPlatformType.SteamClient with steam-user.

    11 hours ago, 4049_1572836826 said:

    Im, try with steam-session - EAuthTokenPlatformType.WebBrowser- renewRefreshToken()
    got: Error: AccessDenied

    This is expected behavior. renewRefreshToken() does not work for EAuthTokenPlatformType.WebBrowser.

  4. You can't log on with SteamUser using cookies; they're only for web sessions, which SteamUser isn't using. SteamUser will automatically save your machine authorization as long as local storage is available (which it should be in most cases), but if you need to manually handle machine auths, check out this section in the docs. You can also use a refresh token to log on, which is sort of like SteamUser's version of a cookie. That's documented here.

  5. Every website out there (that doesn't use HTTP authentication) uses cookies to identify user sessions. Cookies usually contain session IDs, which are looked up on the server in order to determine who the session belongs to. Steam is no different.

    All Steam websites (the store, community, the help site) use the same cookies to identify user sessions. In order to identify a Steam session, only a single steamLoginSecure cookie is required.

    You may also see a sessionid cookie. Despite its name, this cookie is merely a CSRF token (this is verified on Steam's cookie preferences page). Its value can be anything, as long as it matches the sessionid parameter in your state-mutating requests (which should ordinarily only be POST requests, but Valve is Valve and they use GET for some mutation requests). Steam will randomly assign you one the first time you hit one of the websites without already having one, even if you aren't logged in. They are not tied to accounts or to sessions.

    steamLoginSecure is the actual session cookie. It begins with your 64-bit SteamID, followed by two pipe characters percent-encoded as %7C, and then a JWT. If you want to know when your cookie expires, you can decode the JWT and check the exp field. Your IP address is also encoded into the JWT, and it appears that your session may be invalidated if you make a request from a differing IP address.

    Steam Guard auths are handled by the new auth server, and aren't described here. They don't appear to be used if you're using TOTP as your authenticator.

    How to Get Cookies
    The auth server launched in August 2022, alongside the beta of the new Steam Mobile App. The auth server provides a unified authentication interface that is consistent between the three Steam platforms (desktop client, website, mobile app). As of time of writing (2023-10-01), all of the old auth schemes still work, but this can't be expected to remain the case forever.

    Upon successful authentication, the auth server issues an access token and a refresh token. Access tokens are used for the steamLoginSecure cookie. Refresh tokens are used to get new access tokens, and also are used to log into the Steam client. If you want to maintain a session for an extended duration without re-entering your password (or putting it into a config file), refresh tokens are the way to do it.

    The steam-session npm package was created to interface with the auth server. If you need login cookies, this is the best way to get them.

    If you're already using steam-user or steamcommunity, they are using steam-session internally to generate cookies. Outside of special cases, there's no reason for you to use steam-session directly if you're already using steam-user or steamcommunity.

    steam-user
    steam-user uses steam-session for authentication as of v4.28.0, and cookies are generated using the new auth scheme as of v4.29.0. Use the webSession event to acquire your cookies. Cookies generated this way will be invalidated when your SteamUser client disconnects.

    steamcommunity
    steamcommunity uses steam-session for authentication as of v4.0.0. Cookies are returned to you when the login() method promise resolves.

    Cookie Usage
    I'll briefly explain how cookies and sessions work in my libraries. A quick overview on statefulness: HTTP is stateless. Each request is distinct from every other request, and thus there is no way to link two requests together, except by using cookies.

    • steam-user connects to CMs (connection managers, i.e. Steam servers) using long-lived TCP connections. This is a stateful connection, and there's no need to use cookies here. steam-user is capable of producing cookies, but it does not save them and doesn't use them in any way except to make them available to the end-user for use elsewhere.
    • steamcommunity interacts with Steam over HTTP, which does require cookies to authenticate requests. steamcommunity can either accept cookies using the setCookies() method (which can accept cookies obtained by any means, including steam-user), or it can produce cookies by using the login method (which internally uses steam-session). Either method will save the cookies internally in the SteamCommunity object, and those cookies will be used to authenticate every HTTP request.
    • steamstore is identical to steamcommunity, although it cannot create cookies and can only accept them using setCookies().
    • steam-tradeoffer-manager is identical to steamstore, except it uses steamcommunity internally for HTTP communication. Thus, if you instantiate TradeOfferManager and pass a community instance to the constructor, then calling setCookies() on the TradeOfferManager instance will also call setCookies() on the SteamCommunity instance. Therefore, you don't need to call setCookies() on the SteamCommunity instance in this case (although it doesn't hurt anything, either).
    • steam-session is what every producer module uses internally to authenticate with Steam and to produce cookies. If you only need session cookies and don't need to make use of any other modules' features, then you can use steam-session directly.

    Here's a summary table, where a producer can create cookies and a consumer can use cookies.

     

    Producer

    Consumer

    steam-user

     

    steamcommunity

    steamstore

     

    steam-tradeoffer-manager

     

    steam-session

     

×
×
  • Create New...