SHARE
TWEET

Untitled

a guest Aug 13th, 2016 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var serviceAddr = Convert.ToString(ConfigurationManager.AppSettings["auth"]);
  2.             var client_id = Convert.ToString(ConfigurationManager.AppSettings["ClientId"]);
  3.             var username = Convert.ToString(ConfigurationManager.AppSettings["UserName"]);
  4.             var password = Convert.ToString(ConfigurationManager.AppSettings["UserPWD"]);
  5.             var client_secret = Convert.ToString(ConfigurationManager.AppSettings["ClientSec"]);
  6.             var EncKey = "HDI";
  7.             var SFservice = serviceAddr + "?grant_type=password&client_id=" + Decrypt(client_id, EncKey) + "&client_secret=" + Decrypt(client_secret, EncKey) + "&username=" + username + "&password=" + Decrypt(password, EncKey);
  8.  
  9.             var httpWebRequest = (HttpWebRequest)WebRequest.Create(SFservice);
  10.             httpWebRequest.ContentType = "application/json; charset=utf-8";
  11.             httpWebRequest.Method = "POST";
  12.             var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
  13.             var streamReader = new StreamReader(httpResponse.GetResponseStream());
  14.             var result = streamReader.ReadToEnd();
  15.             SFDCResponseAuthToken data = JsonConvert.DeserializeObject<SFDCResponseAuthToken>(result);
  16.             Logger.LogInformation("Token Generated : OAuth " + data.access_token);
  17.             return "OAuth " + data.access_token;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top