Skip to content

Commit

Permalink
Fix SMS problems, resync SteamAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Dec 12, 2015
1 parent 49fc908 commit d526c6c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
11 changes: 9 additions & 2 deletions SteamAuth/AuthenticatorLinker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ public FinalizeResult FinalizeAddAuthenticator(string smsCode)

private bool _addPhoneNumber()
{
string response = SteamWeb.Request(APIEndpoints.COMMUNITY_BASE + "/steamguard/phoneajax?op=add_phone_number&arg=" + WebUtility.UrlEncode(PhoneNumber), "GET", null, _cookies);
var postData = new NameValueCollection();
postData.Add("op", "add_phone_number");
postData.Add("arg", PhoneNumber);
postData.Add("sessionid", _session.SessionID);

string response = SteamWeb.Request(APIEndpoints.COMMUNITY_BASE + "/steamguard/phoneajax", "POST", postData, _cookies);
if (response == null) return false;

var addPhoneNumberResponse = JsonConvert.DeserializeObject<AddPhoneResponse>(response);
Expand All @@ -162,7 +167,9 @@ private bool _hasPhoneAttached()
var postData = new NameValueCollection();
postData.Add("op", "has_phone");
postData.Add("arg", "null");
string response = SteamWeb.MobileLoginRequest(APIEndpoints.COMMUNITY_BASE + "/steamguard/phoneajax", "GET", postData, _cookies);
postData.Add("sessionid", _session.SessionID);

string response = SteamWeb.Request(APIEndpoints.COMMUNITY_BASE + "/steamguard/phoneajax", "POST", postData, _cookies);
if (response == null) return false;

var hasPhoneResponse = JsonConvert.DeserializeObject<HasPhoneResponse>(response);
Expand Down
1 change: 1 addition & 0 deletions SteamAuth/SessionData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public void AddCookies(CookieContainer cookies)
});
cookies.Add(new Cookie("Steam_Language", "english", "/", ".steamcommunity.com"));
cookies.Add(new Cookie("dob", "", "/", ".steamcommunity.com"));
cookies.Add(new Cookie("sessionid", this.SessionID, "/", ".steamcommunity.com"));
}
}
}
6 changes: 3 additions & 3 deletions SteamAuth/SteamGuardAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private bool _sendConfirmationAjax(Confirmation conf, string op)
{
string url = APIEndpoints.COMMUNITY_BASE + "/mobileconf/ajaxop";
string queryString = "?op=" + op + "&";
queryString += _generateConfirmationQueryParams(op);
queryString += GenerateConfirmationQueryParams(op);
queryString += "&cid=" + conf.ConfirmationID + "&ck=" + conf.ConfirmationKey;
url += queryString;

Expand All @@ -235,11 +235,11 @@ private bool _sendConfirmationAjax(Confirmation conf, string op)
public string GenerateConfirmationURL(string tag = "conf")
{
string endpoint = APIEndpoints.COMMUNITY_BASE + "/mobileconf/conf?";
string queryString = _generateConfirmationQueryParams(tag);
string queryString = GenerateConfirmationQueryParams(tag);
return endpoint + queryString;
}

private string _generateConfirmationQueryParams(string tag)
public string GenerateConfirmationQueryParams(string tag)
{
long time = TimeAligner.GetSteamTime();
return "p=" + this.DeviceID + "&a=" + this.Session.SteamID.ToString() + "&k=" + _generateConfirmationHashForTime(time, tag) + "&t=" + time + "&m=android&tag=" + tag;
Expand Down

0 comments on commit d526c6c

Please sign in to comment.