title: Getting connection timeout error while calling get access token Microsoft Graph API through REST POST call
body: <p>I am trying to get access token from <a href="https://login.microsoftonline.com/%7Btenentname%7D/oauth2/v2.0/token" rel="nofollow noreferrer">https://login.microsoftonline.com/{tenentname}/oauth2/v2.0/token</a> endpoints though HttpClient post request. Applied required 4 parameters/headers with the same.
  But I am getting connection timed out. Connection will be retried using another IP address (after trying with 7 different IP address) getting Shutdown connection error. Connection discarded.</p>
  <p>Please find below code snippet.</p>
  <pre><code>HttpClientConnectionManager poolingConnManager = new PoolingHttpClientConnectionManager();    
  HttpPost post = new HttpPost(&quot;https://login.microsoftonline.com/{tenentname}/oauth2/v2.0/token&quot;); 
  List&lt;NameValuePair&gt; urlParameters = new ArrayList&lt;&gt;();
  urlParameters.add(new BasicNameValuePair(&quot;grant_type&quot;, &quot;client_credentials&quot;));
  urlParameters.add(new BasicNameValuePair(&quot;client_id&quot;, {id_value}));
  urlParameters.add(new BasicNameValuePair(&quot;client_secret&quot;, {secret_value}));
  urlParameters.add(new BasicNameValuePair(&quot;scope&quot;, &quot;https://graph.microsoft.com/.default&quot;));
  
  post.setEntity(new UrlEncodedFormEntity(urlParameters));
  post.setHeader(&quot;Content-type&quot;, &quot;application/x-www-form-urlencoded&quot;);
  
  ClosableHttpClinet httpClient = HttpClients.custom().setConnectionManager(poolingConnManager).build();
  ClosableHttpResponse response = httpClinet.execute(post);
  System.out.println(EntityUtils.toString(response.getEntity()));
  </code></pre>
  <p>Same its worked with Postman without any proxy setting, I am getting proper response in Postman.
  Please assist on the same.</p>