using System;
using System.Security.Cryptography.X509Certificates;
using RestSharp;
namespace pix
{
class Program
{
static void Main(string[] args)
{
X509Certificate2 uidCert = new X509Certificate2("./certificado.p12", "");
var client = new RestSharp.RestClient("
https://api-pix-h.gerencianet.com.br/oauth/token");
client.ClientCertificates = new X509CertificateCollection() { uidCert };
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\r\n \"grant_type\": \"client_credentials\"\r\n}", ParameterType.RequestBody);
IRestResponse restResponse = client.Execute(request);
string response = restResponse.Content;
Console.WriteLine(response);
}
}
}