public void FinalizeAddAuthenticator(IWebRequest web, string smsCode, FinalizeCallback callback) { var postData = new Dictionary <string, string> { ["steamid"] = this.session.SteamID.ToString(), ["access_token"] = this.session.OAuthToken, ["activation_code"] = smsCode }; var tries = 0; Callback makeRequest = r => { }; WebCallback reqCallback = (response, code) => { if (tries > 30) { callback(FinalizeResult.GeneralFailure); return; } if (response == null || code != HttpStatusCode.OK) { callback(FinalizeResult.GeneralFailure); return; } var finalizeResponse = JsonConvert.DeserializeObject <WebResponse <FinalizeAuthenticatorResponse> >(response); if (finalizeResponse?.Response == null) { callback(FinalizeResult.GeneralFailure); return; } if (finalizeResponse.Response.Status == 89) { callback(FinalizeResult.BadSMSCode); return; } if (finalizeResponse.Response.Status == 88) { if (tries >= 30) { callback(FinalizeResult.UnableToGenerateCorrectCodes); return; } } if (!finalizeResponse.Response.Success) { callback(FinalizeResult.GeneralFailure); return; } if (finalizeResponse.Response.WantMore) { tries++; this.LinkedAccount.GenerateSteamGuardCode(web, makeRequest); return; } this.LinkedAccount.FullyEnrolled = true; callback(FinalizeResult.Success); }; makeRequest = response => { postData["authenticator_code"] = response; TimeAligner.GetSteamTime(web, steamTime => { postData["authenticator_time"] = steamTime.ToString(); web.MobileLoginRequest(ApiEndpoints.STEAMAPI_BASE + "/ITwoFactorService/FinalizeAddAuthenticator/v0001", "POST", postData, reqCallback); }); }; //The act of checking the SMS code is necessary for Steam to finalize adding the phone number to the account. //Of course, we only want to check it if we're adding a phone number in the first place... if (!string.IsNullOrEmpty(this.PhoneNumber)) { this._checkSMSCode(web, smsCode, b => { if (b) { this.LinkedAccount.GenerateSteamGuardCode(web, makeRequest); } else { callback(FinalizeResult.BadSMSCode); } }); } else { this.LinkedAccount.GenerateSteamGuardCode(web, makeRequest); } }