Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Net;
- using System.Text;
- using System.Windows.Forms;
- namespace Login
- {
- public partial class LoginForm : Form
- {
- public LoginForm()
- {
- InitializeComponent();
- }
- private void loginButton_Click(object sender, EventArgs e)
- {
- string username = usernameTextBox.Text;
- string password = passwordTextBox.Text;
- string postData = "scope=openid&client_id=36926892495301a63b2e9350a38d3d6dbf72ad81e571a3ebba4687250ec8f352c70b3e91229602f73e1335528f3caa00a5cf513f484d7003784e722f2ce7a216&redirect_uri=http%3A%2F%2Fwww.twitch.tv%2F&response_type=code&state=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyZWRpcmVjdF9wYXRoIjoiaHR0cDovL3d3dy50d2l0Y2gudHYvIn0.bvJnmxyvmepBV4cxdGbNevMJj_ki4cTn0OxmJBy8Lkc&nonce=8f24aa00cd07af0f4ea4cac613566629aab5e1d1&from_embed=false&username=" + username + "&password=" + password;
- UTF8Encoding encoding = new UTF8Encoding();
- byte[] postValue = encoding.GetBytes(postData);
- HttpWebRequest postRequest = (HttpWebRequest)WebRequest.Create("https://passport.twitch.tv/authentications/new");
- postRequest.Method = WebRequestMethods.Http.Post;
- postRequest.ContentType = "application/x-www-form-urlencoded";
- postRequest.Referer = "https://passport.twitch.tv/authentications/new?client_id=36926892495301a63b2e9350a38d3d6dbf72ad81e571a3ebba4687250ec8f352c70b3e91229602f73e1335528f3caa00a5cf513f484d7003784e722f2ce7a216&embed=0&error_code=&nonce=8f24aa00cd07af0f4ea4cac613566629aab5e1d1&redirect_uri=http%3A%2F%2Fwww.twitch.tv%2F&response_type=code&scope=openid&state=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyZWRpcmVjdF9wYXRoIjoiaHR0cDovL3d3dy50d2l0Y2gudHYvIn0.bvJnmxyvmepBV4cxdGbNevMJj_ki4cTn0OxmJBy8Lkc&stay_embedded=0&sudo_reason=&username=";
- postRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36";
- postRequest.ContentLength = postValue.Length;
- using (Stream postRequestStream = postRequest.GetRequestStream())
- {
- postRequestStream.Write(postValue, 0, postValue.Length);
- HttpWebResponse postResponse = (HttpWebResponse)postRequest.GetResponse();
- StreamReader postRequestReader = new StreamReader(postResponse.GetResponseStream());
- string document = postRequestReader.ReadToEnd();
- twitchWebBrowser.DocumentText = document;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement