private static function handleSMS() { if (!isset($_POST['sms'])) { return; } $tries = 0; while ($tries < 30) { $code = SteamGuard::generateSteamGuardCode(self::$authData->shared_secret); $res = Net::doRequest('https://api.steampowered.com/ITwoFactorService/FinalizeAddAuthenticator/v0001', [], ['steamid' => self::$authData->steamid, 'access_token' => self::$authData->access_token, 'activation_code' => $_POST['sms'], 'authenticator_code' => $tries == 0 ? '' : $code[0], 'authenticator_time' => $code[1]], 'https://steamcommunity.com/mobilelogin?oauth_client_id=DE45CD61&oauth_scope=read_profile%20write_profile%20read_client%20write_client'); $data = json_decode($res[1]); if ($data->response->status == 89) { //die("Bad SMS Code"); break; } if (!$data->response->success) { //die("Fail"); break; } if ($data->response->want_more) { $_POST['sms'] = ''; $tries++; continue; } return ['success' => true]; } return ['success' => false]; }
public function doLogin($cookies) { $encPass = $this->getEncryptedPassword(); $res = Net::doRequest('https://steamcommunity.com/login/dologin/', $cookies, ['username' => $this->user, 'password' => $encPass['code'], 'twofactorcode' => '', 'captchagid' => $this->captchaGid, 'captcha_text' => $this->captchaText, 'emailsteamid' => $this->emailSteamId, 'emailauth' => $this->twoFactorCode, 'rsatimestamp' => $encPass['time'], 'remember_login' => false, 'oauth_client_id' => 'DE45CD61', 'oauth_scope' => 'read_profile write_profile read_client write_client', 'loginfriendlyname' => 'escrow.tf']); $this->loginData = json_decode($res[1], true); if (isset($this->loginData['oauth'])) { $this->loginData['oauth'] = new Oauth(json_decode($this->loginData['oauth'])); } // Get steam to send an email even when a bad code is supplied if (!$loginData['success'] && isset($loginData['emailauth_needed']) && $loginData['emailauth_needed'] && !empty($this->twoFactorCode)) { $this->setTwoFactorCode(''); return $this->doLogin($cookies); } return $this->loginData; }
public static function startSession() { $res = Net::doRequest('https://steamcommunity.com/login?oauth_client_id=DE45CD61&oauth_scope=read_profile%20write_profile%20read_client%20write_client', self::DEFAULT_COOKIES); return $res[0]; }
public function refreshSession() { $res = Net::doRequest('https://api.steampowered.com/IMobileAuthService/GetWGToken/v0001', [], ['access_token' => $this->oauth->access_token]); $out = json_decode($res[1], true); $this->oauth->wgtoken = $out['response']['token']; $this->oauth->wgtoken_secure = $out['response']['token_secure']; return; }