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:
mywebsite.com https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=.... https://mycompany.my.salesforce.com/setup/secur/RemoteAccessAuthorizationPage.apexp?.... https://mywebsite.com/authentication/callback?display=page... mywebsite.com ...LOOP CONTINUES FOREVER
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?