• Blagoj Petrovski
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
When I try to authenticate to SalesForce in order to get access to the data I get this message: "retry your request".
The authentication was successful till this morning. I know that for unsuccessful authentication you should receive different error (authentication failure).

How to overcome this issue?

This is my code:
 string securityToken = ConfigurationManager.AppSettings["SecurityToken"];
            string ConsumerKey = ConfigurationManager.AppSettings["ConsumerKey"];
            string ConsumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"];
            string Username = ConfigurationManager.AppSettings["Username"];
            string Password = ConfigurationManager.AppSettings["Password"] + securityToken;
            string IsSandboxUser = ConfigurationManager.AppSettings["IsSandboxUser"];

            var url = IsSandboxUser.Equals("true", StringComparison.CurrentCultureIgnoreCase)
                ? "https://test.salesforce.com/services/oauth2/token"
                : "https://login.salesforce.com/services/oauth2/token";

            var auth = new AuthenticationClient(new HttpClient());
            try
            {
                await auth.UsernamePasswordAsync(ConsumerKey, ConsumerSecret, Username, Password, url);
            }
            catch (Exception ex)
            {
                throw;
            }