summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/api
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-05-27 22:08:58 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-05-27 22:08:58 +0000
commita2cbb34b00f6de9d7f5d49fad02dc6f94ccf81db (patch)
treee8e41d62fff06e8bdfd535404a5ec7957d3ae5f6 /protocols/Steam/src/api
parentd2a5706a5c4ed7620030377ffe32f093b14d3177 (diff)
Steam: reworked login
git-svn-id: http://svn.miranda-ng.org/main/trunk@13865 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/api')
-rw-r--r--protocols/Steam/src/api/authorization.h54
-rw-r--r--protocols/Steam/src/api/rsa_key.h11
2 files changed, 20 insertions, 45 deletions
diff --git a/protocols/Steam/src/api/authorization.h b/protocols/Steam/src/api/authorization.h
index e7b2ee8c39..d3ebc8246c 100644
--- a/protocols/Steam/src/api/authorization.h
+++ b/protocols/Steam/src/api/authorization.h
@@ -4,55 +4,27 @@
class AuthorizationRequest : public HttpRequest
{
public:
- AuthorizationRequest(const char *username, const char *password, const char *timestamp) :
- HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobilelogin/dologin")
+ 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;
- char data[1024];
- mir_snprintf(data, SIZEOF(data),
- "username=%s&password=%s&oauth_client_id=3638BFB1&oauth_scope=read_profile write_profile read_client write_client&captchagid=-1&rsatimestamp=%s",
- ptrA(mir_urlEncode(username)),
- ptrA(mir_urlEncode(password)),
- timestamp);
+ 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");
- SetData(data, strlen(data));
- AddHeader("Content-Type", "application/x-www-form-urlencoded");
- }
-
- AuthorizationRequest(const char *username, const char *password, const char *timestamp, const char *guardCode) :
- HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobilelogin/dologin")
- {
- flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP;
-
- char data[1024];
- mir_snprintf(data, SIZEOF(data),
- "username=%s&password=%s&emailauth=%s&loginfriendlyname=MirandaNG&oauth_client_id=3638BFB1&oauth_scope=read_profile write_profile read_client write_client&captchagid=-1&rsatimestamp=%s",
- ptrA(mir_urlEncode(username)),
+ CMStringA data(CMStringDataFormat::FORMAT,
+ "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)),
- guardCode,
- timestamp);
-
- SetData(data, strlen(data));
- AddHeader("Content-Type", "application/x-www-form-urlencoded");
- }
-
- AuthorizationRequest(const char *username, const char *password, const char *timestamp, const char *captchaId, const char *captchaText) :
- HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobilelogin/dologin")
- {
- flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP;
-
- char data[1024];
- mir_snprintf(data, SIZEOF(data),
- "username=%s&password=%s&emailauth=&captchagid=%s&captcha_text=%s&oauth_client_id=3638BFB1&oauth_scope=read_profile write_profile read_client write_client&rsatimestamp=%s",
ptrA(mir_urlEncode(username)),
- ptrA(mir_urlEncode(password)),
+ twofactorcode,
+ guardCode,
+ "Miranda%20NG",
captchaId,
ptrA(mir_urlEncode(captchaText)),
- timestamp);
-
- SetData(data, strlen(data));
- AddHeader("Content-Type", "application/x-www-form-urlencoded");
+ guardId,
+ timestamp,
+ time(NULL));
+ SetData(data.GetBuffer(), data.GetLength());
}
};
diff --git a/protocols/Steam/src/api/rsa_key.h b/protocols/Steam/src/api/rsa_key.h
index 6b938a48ef..1cf33d15ab 100644
--- a/protocols/Steam/src/api/rsa_key.h
+++ b/protocols/Steam/src/api/rsa_key.h
@@ -1,15 +1,18 @@
#ifndef _STEAM_REQUEST_RSA_KEY_H_
#define _STEAM_REQUEST_RSA_KEY_H_
-class RsaKeyRequest : public HttpRequest
+class GetRsaKeyRequest : public HttpRequest
{
public:
- RsaKeyRequest(const char *username) :
- HttpRequest(REQUEST_GET, STEAM_WEB_URL "/mobilelogin/getrsakey")
+ GetRsaKeyRequest(const char *username) :
+ HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobilelogin/getrsakey/")
{
flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP;
- AddParameter("username", (char*)username);
+ AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
+
+ CMStringA data(CMStringDataFormat::FORMAT, "username=%s&donotcache=%lld", ptrA(mir_urlEncode(username)), time(NULL));
+ SetData(data.GetBuffer(), data.GetLength());
}
};