Samuraix
Member
- Joined
- Aug 9, 2021
- Messages
- 9
- Programming Experience
- Beginner
Hi,
I created an aplication to return the TOKEN in C# using HTTPCLIENT and when I execute in the Window Server 2012 R2 is returning the error of SLL HANDSHAKE_FAILURE.
When I run the same application in the Windows 10 or Windows Server 2016 run perfectly.
And when I run the same application in others endpoints in the Windows Server 2012 R2 run sucessfuly, just to the endpoint "https://api.smartleader.com.br/oauth/token", that is hosted in the Amazon return error.
Can some people help me?
Below the code:
I created an aplication to return the TOKEN in C# using HTTPCLIENT and when I execute in the Window Server 2012 R2 is returning the error of SLL HANDSHAKE_FAILURE.
When I run the same application in the Windows 10 or Windows Server 2016 run perfectly.
And when I run the same application in others endpoints in the Windows Server 2012 R2 run sucessfuly, just to the endpoint "https://api.smartleader.com.br/oauth/token", that is hosted in the Amazon return error.
Can some people help me?
Below the code:
C#:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Security;
using System.Text;
using System.Threading.Tasks;
namespace TESTE3
{
class Program
{
static void Main(string[] args)
{
string token = "";
using (var client = new HttpClient())
{
Dictionary<string, string> postvalues = new Dictionary<string, string>
{
{ "client_id", "99" },
{ "client_secret", "blablabla" },
{ "grant_type", "client_credentials" },
{ "scope", "sml-integration" }
};
var content = new FormUrlEncodedContent(postvalues);
var response = client.PostAsync("https://api.smartleader.com.br/oauth/token", content).Result.Content.ReadAsStringAsync().Result;
Dictionary<string, string> responseJSON = JsonConvert.DeserializeObject<Dictionary<string, string>>(response);
token = responseJSON["access_token"];
}
Console.WriteLine(token);
}
}
}
Last edited by a moderator: