Advertisement
Guest User

Untitled

a guest
Sep 27th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. consumerkey = ConfigurationManager.AppSettings["Salesforce_consumerkey"];
  2. consumersecret = ConfigurationManager.AppSettings["Salesforce_consumersecret"];
  3. username = ConfigurationManager.AppSettings["Salesforce_user"];
  4. password = ConfigurationManager.AppSettings["Salesforce_password"];
  5.  
  6. AuthenticationClient auth = null;
  7. Task t = null;
  8.  
  9. try
  10. {
  11. //create auth client to retrieve token
  12. auth = new AuthenticationClient();
  13.  
  14. //get back URL and token
  15. t = auth.UsernamePasswordAsync(consumerkey, consumersecret, username, password);
  16. t.Wait();
  17. }
  18. catch (Exception e)
  19. {
  20. throw new Exception("Fail to create SF authentication", e);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement