Steam authorization

I'm trying to get html code of authorizated steam page, but I can't log in. My code is

public string tryLogin(string EXP, string MOD, string TIME)
{
    var rsa = new RSA();
    string encryptedPass;
    rsa.Exponent = EXP;
    rsa.Modulus = MOD;
    encryptedPass = rsa.Encrypt(Pass);

    string reqString = "username=kasyjack&password=" + encryptedPass + "&emailauth=&kasyjackfriendlyname=&captchagid=&captcha_text=&emailsteamid=&rsatimestamp=" + TIME + "&remember_login=false";
    byte[] requestData = Encoding.UTF8.GetBytes(reqString);

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://store.steampowered.com/login/dologin/");
    request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
    request.ContentLength = requestData.Length;
    request.Host = "store.steampowered.com";
    request.Method = "POST";
    request.UserAgent = Http.ChromeUserAgent();
    request.CookieContainer = _CookieCont;

    using (Stream st = request.GetRequestStream())
        st.Write(requestData, 0, requestData.Length);

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    StreamReader sr = new StreamReader(response.GetResponseStream());
    string RSAR = sr.ReadToEnd();
    return RSAR;
}

but response message is

{"success":false,"requires_twofactor":false,"clear_password_field":true,"captcha_needed":false,"captcha_gid":-1,"message":"Incorrect login."}

So does anyone know, what's wrong with login? Need your help.

Upvotes: 2

Views: 2186

Answers (1)

Ginkgo
Ginkgo

Reputation: 155

SteamBot repository on GitHub has a working example on how to login to Steam via their website: link to method.

Here is a diagram explaining the whole process(made by me):

Steam Web Login

Upvotes: 1

Related Questions