Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void LogIn()
- {
- string username = "xxx";
- string password = "xxx";
- string url = "http://xxxxx/api/token/";
- HttpWebRequest tokenRequest = (HttpWebRequest)WebRequest.Create(url);
- string encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
- tokenRequest.Headers.Add("Authorization", "Basic " + encoded);
- tokenRequest.Method = "POST";
- HttpWebResponse tokenResponse = (HttpWebResponse)tokenRequest.GetResponse();
- Debug.Log (tokenResponse);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement