This problem has occurred in a few of our applications that use the same forms of salesforce oauth authentication.

When you first navigate to mywebsite.com, it sends you to salesforce to login, once you login, you get redirected in a loop like this:






There are dozens of details I could include, but I'm not sure which ones are relevant. To start: this is a .NET Framework application, using the Owin.Security.Providers.Salesforce nuget package, running on IIS on a windows AWS server.

This code works fine in dev (localhost) on my machine, it works on multiple production boxes, and only fails on a new server with a new test environment. The salesforce app settings are the same between all three environments except for the URLs, which work, plus the client ID and Secret, which are properly pasted into my test web config.

Is there any way to debug this? What other details would help here?

  • Are you storing the response in a cookie or any other means (i.e. browser cache) once they complete the sign in and checking this on the load of your home page to determine if the user's have already authenticated? It sounds like this is not happening, or is not being retained
    – Ronnie
    Commented Jan 25, 2020 at 17:22
  • @Ronnie the response token is stored in a cookie. I think the library code is not liking the token for some reason but after putting throw statements in the controllers, they don’t actually throw, so I think the failure is happening in the Salesforce library code where I can’t debug it.
    – JacobIRR
    Commented Jan 25, 2020 at 20:29
  • you can debug it if you start debugging once you enter your code and step through it in console. I would start there first this way you can walk your way through and take a look at what you're seeing when you come back to your check. obviously there is some issue after it comes back to your page. would be interesting to check the cookie contents on the return.
    – Ronnie
    Commented Jan 26, 2020 at 1:51

1 Answer 1


The problem was related to IIS not allowing cookies for my test domain. I had to change the node in the web.test.config to use the new domain. Hopefully this helps someone in the future.

  • 1
    We had a similar issue recently that only affected chrome. It was tied to the site settings for cookies, wasn't widespread, only based per user. Also caused lightning to load super slow.
    – Ronnie
    Commented Jan 28, 2020 at 21:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .