summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/api/authorization.h
blob: af0cdd4bf6860588649562b2f8027f4d3a5f3d6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef _STEAM_REQUEST_AUTHORIZATION_H_
#define _STEAM_REQUEST_AUTHORIZATION_H_

class AuthorizationRequest : public HttpRequest
{
public:
	AuthorizationRequest(const char *username, const char *password, const char *timestamp, const char *twofactorcode, const char *guardCode, const char *guardId = "", const char *captchaId = "-1", const char *captchaText = "") :
		HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobilelogin/dologin/")
	{
		flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP;

		AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
		AddHeader("Referer", STEAM_WEB_URL "/mobilelogin/dologin?oauth_client_id=3638BFB1&oauth_scope=read_profile%20write_profile%20read_client%20write_client");
		AddHeader("Cookie", "mobileClientVersion=1291812;forceMobile=1;mobileClient=ios");

		CMStringA data;
		data.AppendFormat("password=%s&username=%s&twofactorcode=%s&emailauth=%s&loginfriendlyname=%s&oauth_client_id=3638BFB1&captchagid=%s&captcha_text=%s&emailsteamid=%s&rsatimestamp=%s&rememberlogin=false&donotcache=%lld",
			ptrA(mir_urlEncode(password)),
			ptrA(mir_urlEncode(username)),
			twofactorcode,
			guardCode,
			"Miranda%20NG",
			captchaId,
			ptrA(mir_urlEncode(captchaText)),
			guardId,
			timestamp,
			time(NULL));
		SetData(data, data.GetLength());
	}
};

#endif //_STEAM_REQUEST_AUTHORIZATION_H_