SteamRE / SteamKit

SteamKit2 is a .NET library designed to interoperate with Valve's Steam network. It aims to provide a simple, yet extensible, interface to perform various actions on the network.
GNU Lesser General Public License v2.1
2.56k stars 489 forks source link

SteamUser.LoginKeyCallback not returning #1068

Closed pbogre closed 2 years ago

pbogre commented 2 years ago

I have managed to login the user but cannot find a way to retrieve the steamLogin cookie of that session once I login.

The steamLogin cookie I need looks like [steam ID x64]%7C%7C[Token], and the token is the part I cannot find. I tried using SteamUser.LoginKeyCallback and get the LoginKey from that callback but it just ends up waiting forever for the callback to happen.

Clearly I'm doing something wrong, and I need this steamLogin cookie in order to make a post request and edit the profile I logged into. I'm not sure whether the LoginKey is what I'm looking for and when I went digging into the SteamBot files I found the way that it's done there:

authResult = userAuth.AuthenticateUser(
    steamid: client.SteamID.ConvertToUInt64(),
    sessionkey: HttpUtility.UrlEncode(cryptedSessionKey),
    encrypted_loginkey: HttpUtility.UrlEncode(cryptedLoginKey),
    method: "POST",
    secure: true
);
Token = authResult["token"].AsString();
TokenSecure = authResult["tokensecure"].AsString();

I was not able to figure how what AuthenticateUser returns. If any of you is able to set me in the right direction I would greatly appreciate that

pbogre commented 2 years ago

Quick Update: I found out what userAuth.AuthenticateUser returns and it's actually from the Steam Web API (https://partner.steamgames.com/doc/webapi/ISteamUserAuth). I managed to create and encrypt a session key, i have the steam id, and all that remains is the login key which I assume is the one that SteamUser.LoginKeyCallback has. Once I have that I need to create a post request and get the token from the response.

The only problem now is I still can't get that callback to work. The description says "This callback is returned some time after logging onto the network." but no matter how long I wait nothing happens

pbogre commented 2 years ago

I'm the dumbest person alive and stopped the callback handling loop after logon