Jessecar96 / SteamBot

Automated bot software for interacting with Steam Trade
http://scrap.tf
MIT License
1.33k stars 910 forks source link

What could cause token to return null in SteamWeb.Authenticate? #191

Closed waylaidwanderer closed 11 years ago

waylaidwanderer commented 11 years ago

I'm having a strange problem here. Basically when SteamBot launches, something is causing the token in bool authd = SteamWeb.Authenticate (callback, SteamClient, out sessionId, out token); in Bot.cs to return as null every time, and so it keeps looping "Authentication failed, retrying in 2s..." until I press Ctrl+C.

Does anyone have any ideas as to why token would return as null? In SteamWeb.cs' Authenticate function, here's the section of code that would cause it to return null, but I don't know why.

   try
   {
        authResult = userAuth.AuthenticateUser (
            steamid: client.SteamID.ConvertToUInt64 (),
            sessionkey: HttpUtility.UrlEncode (cryptedSessionKey),
            encrypted_loginkey: HttpUtility.UrlEncode (cryptedLoginKey),
            method: "POST"
            );
   }
   catch (Exception)
   {
       token = null;
       return false;
   }
teliosdev commented 11 years ago

Check out the exception that's being thrown.

waylaidwanderer commented 11 years ago

Just says something like exception thrown at Boolean SteamWeb.Authenticate (callback, SteamClient, out sessionId, out token);.

Not much use :(

waylaidwanderer commented 11 years ago

Upon further digging, it gives me this: System.NullReferenceException: Object reference not set to an instance of an object when it tries to get the value of client.SteamID.ConvertToUInt64 (). Do you know why?

waylaidwanderer commented 11 years ago

This is all set upon SteamBot logging in (for example the client thing), and I think the problem is that the LoggedOnCallback is not returning OK for some reason.

waylaidwanderer commented 11 years ago

Actually, SteamUser.LoggedOnCallback is not being sent at all. It's being skipped (I'm comparing it to a working bot).

waylaidwanderer commented 11 years ago

After more testing, it seems that SteamUser.LoggedOnCallback triggers when I enter the wrong password or SteamGuard code needs to be entered. However, if the password is correct and SteamGuard is not needed, then SteamUser.LoggedOnCallback doesn't trigger.

Blackcode commented 11 years ago

one of the error I get there is 'SteamKit2.WebAPI.Interface' does not contain a definition for 'AuthenticateUser'

Blackcode commented 11 years ago

and here:

   public override DynamicMetaObject BindGetMember(GetMemberBinder binder)
    {
      return IsOverridden("TryGetMember")
           ? CallMethodWithResult("TryGetMember", binder, NoArgs, e => binder.FallbackGetMember(this, e))
           : base.BindGetMember(binder);
    }

I get this error:

'Newtonsoft.Json.Linq.JObject' does not contain a definition for 'success'
teliosdev commented 11 years ago

Can you show the whole stack trace?

Blackcode commented 11 years ago

the problem is described here https://github.com/Jessecar96/SteamBot/issues/207

teliosdev commented 11 years ago

Is this still an issue?

waylaidwanderer commented 11 years ago

Nah. Please close it for me since I'm on my phone. Thanks.

Jeremy Rodi notifications@github.com wrote:

Is this still an issue?


Reply to this email directly or view it on GitHub: https://github.com/Jessecar96/SteamBot/issues/191#issuecomment-17185606