From d526c6c1ced0312085435f356d0164e594632d10 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sat, 12 Dec 2015 06:54:25 +0100 Subject: [PATCH] Fix SMS problems, resync SteamAuth --- SteamAuth/AuthenticatorLinker.cs | 11 +++++++++-- SteamAuth/SessionData.cs | 1 + SteamAuth/SteamGuardAccount.cs | 6 +++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/SteamAuth/AuthenticatorLinker.cs b/SteamAuth/AuthenticatorLinker.cs index a30c6a00e8d24..39f1d99a98bca 100644 --- a/SteamAuth/AuthenticatorLinker.cs +++ b/SteamAuth/AuthenticatorLinker.cs @@ -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(response); @@ -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(response); diff --git a/SteamAuth/SessionData.cs b/SteamAuth/SessionData.cs index 40905b92ef475..692ae60a96ddb 100644 --- a/SteamAuth/SessionData.cs +++ b/SteamAuth/SessionData.cs @@ -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")); } } } diff --git a/SteamAuth/SteamGuardAccount.cs b/SteamAuth/SteamGuardAccount.cs index 054b95e22a988..1da6ae69fc207 100644 --- a/SteamAuth/SteamGuardAccount.cs +++ b/SteamAuth/SteamGuardAccount.cs @@ -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; @@ -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;