Tech Stack:
- ASP.NET Web page application
- .NET Framework 4.7
- Transitioning from Ping Federate to Azure AD
- Windows 2016 Server
- Flow => OAuth 2.0 auth code grant
We have a PING Federate OpenId Connect solution working for single sign-on on the IIS server. When converting to Azure AD, the C# code works on the dev machine (localhost). But when deployed to IIS Server, the token request call times out after 2 minutes.
On the IIS, the authorization call works fine and returns the code successfully, but when the API call is made to get token, it times out.
Auth url =
/{tenant}/oauth2/v2.0/authorize
Token url =
/{tenant}/oauth2/v2.0/token
Code:
var client = new HttpClient();
var stringContent = new StringContent(this.ToString(), Encoding.UTF8, "application/x-www-form-urlencoded");
var response = client.PostAsync(tokenUri, stringContent).Result;
response.EnsureSuccessStatusCode();
string responseBody = response.Content.ReadAsStringAsync().Result;
Not sure if it needs additional IIS settings? Or firewall port opening?