Histórico de mensagens sobre credentials

EXIBINDO CONVERSAS RECENTES:

Texto: credentials
# pix
Avatar discord do usuario rozer9580

rozer9580

x-amzn-requestid: 9367a7d9-a47b-4002-a7d2-9f5344a21e93
content-length: 70
x-amzn-remapped-content-length: 70
x-amzn-remapped-connection: keep-alive
x-request-id: ab5e47a4-28f2-4e94-84d0-9e7a8a1c456b
x-amz-apigw-id: P59iyGQhoAMFxFw=
vary: Origin
etag: W/"46-XAD/Fng+Qq6nuJUwSmDmoLFq8bc"
x-amzn-remapped-date: Fri, 01 Apr 2022 14:43:55 GMT
access-control-allow-credentials: true
content-type: application/json; charset=utf-8
date: Fri, 01 Apr 2022 14:43:55 GMT

{"nome":"erro_interno_servidor","mensagem":"Erro interno do servidor"}ArrayCurl info:

# pix
Avatar discord do usuario hubner7903

hubner7903

let https = require('https');
let agent = new https.Agent({
pfx: certificado,
passphrase: ''
})

var axios = require('axios');
var data = JSON.stringify({ grant_type: 'client_credentials'});

var config = {
method: 'post',
url: 'https://api-pix-h.gerencianet.com.br/oauth/token',
headers: {
'Authorization':
Basic ${base64},
'Content-Type': 'application/json',

},
httpsAgent: agent,
data: data
};

try {
const response = await axios.request(config);
return response.data
} catch (error) {
console.error(error);
}

# pix
Avatar discord do usuario joao_efi

joao_efi

Com o axios, tente algo nessa linha..

ts
const requisicao = {
method: 'POST',
url: 'https://api-pix-h.gerencianet.com.br/oauth/token',
headers: {
Authorization: Basic ${base64},
'Content-Type': 'application/json',
},
httpsAgent: config.agent,
data: JSON.stringify({ grant_type: 'client_credentials' }),
};

let userToken = axios(requisicao)
.then((response) => {
console.log(response);
return response.data.access_token;
})
.catch((error) => {
console.error(error);
});

return userToken;

# pix
Avatar discord do usuario hubner7903

hubner7903

const certificado = await this.movimentoService.certificado_gn();
const client_id = await this.movimentoService.client_id_gn();
const client_secret = await this.movimentoService.client_secret_gn();
const base64 = Buffer.from(${client_id}:${client_secret}).toString("base64");

let https = require('https');
let agent = new https.Agent({
pfx: certificado,
passphrase: ''
})

var axios = require('axios');
var data = JSON.stringify({ grant_type: 'client_credentials'});

var config = {
method: 'post',
url: 'https://api-pix-h.gerencianet.com.br/oauth/token',
headers: {
'Authorization': Basic ${base64},
'Content-Type': 'application/json',

},
httpsAgent: agent,
data: data
};

console.log(config)
console.log('=======================================================================')
try {
const response = await axios.request(config);
return response.data
} catch (error) {
console.error(error);
}

# cartões
Avatar discord do usuario igor_efi

igor_efi

Ver Respostas

Bom dia, João! Através do plugin Flutter você consegue gerar o payment_token, segue abaixo um exemplo:

Map credentials = {
'account_id': '',
'sandbox': true,
};

Gerencianet gn = Gerencianet(credentials);

Map card = {
"brand": "",
"number": "",
"cvv": "",
"expiration_month": "",
"expiration_year": ""
};


dynamic paymentToken = await gn.call("paymentToken", body: card);

# pix
Avatar discord do usuario jocileudosousa

jocileudosousa

$client = new Client();

$endpoint = $baseUrl."/oauth/token";
$response = $client->request('POST', $endpoint, [
'debug' => true,
'header' => [
'Content-type' => 'application-json',
],
'auth' => [$clientId, $clientSecret],
'form_params' => ['gran_type' => 'client_credentials'],
'cert' => $certificate
]);

# bolix
Avatar discord do usuario Agus Rubio

Agus Rubio

Oi, tudo bem? Sou da Tuna Pagamentos, a gente está tentando ativar uns clientes que querem utilizar gerencia net. Eles enviaram as chaves de prod, mas quando tentamos autenticar da "{\"error\":\"invalid_client\",\"error_description\":\"Invalid or inactive credentials\"}"

# pix
Avatar discord do usuario schoeps2724

schoeps2724

Ver Respostas

ustilizo curl_setopt_array($curl, array(
CURLOPT_URL => $vrota,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => '{"grant_type": "client_credentials"}',
CURLOPT_SSLCERT => $config['certificado'],
CURLOPT_SSLCERTPASSWD => "",
CURLOPT_HTTPHEADER => array(
"Authorization: Basic $autorizacao",
"Content-Type: application/json"
),
));

# pix
Avatar discord do usuario javi3966

javi3966

define ('BASEPATH',__DIR__);
require __DIR__ . '/vendor/vendor/autoload.php';

use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;

$file = file_get_contents(__DIR__ . '/vendor/vendor/gerencianet/gerencianet-sdk-php/src/Gerencianet/config.json');
$options = json_decode($file, true);

require_once 'credentials.php';
estou iniciando o código assim para o "Cobrança imediata sem txid"

# pix
Avatar discord do usuario matheusbaldasso1363

matheusbaldasso1363

Bom dia, estamos tentando fazer a autenticação no endpoint /oauth/token com os dados de homologação e estamos recebendo acesso negado. Já configurei o client id e o client password e setei o certificado .p12 com os dados de homologação mas não funciona: segue o erro
{
"error": "invalid_client",
"error_description": "Invalid or inactive credentials"
}

# pix
Avatar discord do usuario franciscosimoes2416

franciscosimoes2416

Ver Respostas

{"error":"invalid_client","error_description":"Invalid or inactive credentials"}

# pix
Avatar discord do usuario rsdeveloper2757

rsdeveloper2757

public static function getToken()
{
try {
$guzzle = new Client([
'headers' => [
'Content-Type' => 'application/json',
],
/ Desativar SSL/
'verify' => true
]);

$response = $guzzle->request('POST', 'https://api-pix-h.gerencianet.com.br/oauth/token',
[
'grant_type' => 'client_credentials',
'client_id' => 'Client_Id_e6e0827b856f2b',
'client_secret' => 'Client_Secret_477f1d5694cd27029a82
',
'cert' => [storage_path('app/public/certificados/files/h-329571-erp_tributos.pem'), null],
]
);

$body = $response->getBody();
$contents = $body->getContents();
$token = json_decode($contents);

return $token->access_token;

} catch (GuzzleException $e) {
echo $e->getMessage();
}
}

Não consigo acessar a autenticação na api

Gera esse erro
Server error: POST https://api-pix-h.gerencianet.com.br/oauth/token resulted in a 500 Internal Server Error response: {"nome":"erro_interno_servidor","mensagem":"Erro interno do servidor"}

# pix
Avatar discord do usuario palloma_efi

palloma_efi

Ver Respostas

Você pode tentar realizar a conversão a partir deste exemplo de autenticação:

using System;
using System.Security.Cryptography.X509Certificates;
using System.Collections.Generic;
using RestSharp;

namespace PixGerencianet
{
class Authorize
{
public static string Base64Encode(string plainText)
{
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
return System.Convert.ToBase64String(plainTextBytes);
}

static void Main(string[] args)
{

var credencials = new Dictionary{
{"client_id", "YOUR-CLIENT-ID"},
{"client_secret", "YOUR-CLIENT-SECRET"}
};
var authorization = Base64Encode(credencials["client_id"] + ":" + credencials["client_secret"]);
var client = new RestSharp.RestClient("https://api-pix-h.gerencianet.com.br/oauth/token");
var request = new RestRequest(Method.POST);

X509Certificate2 uidCert = new X509Certificate2("./certificado.p12", "");
client.ClientCertificates = new X509CertificateCollection() { uidCert };

request.AddHeader("Authorization", "Basic " + authorization);
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);
}
}
}

# pix
Avatar discord do usuario palloma_efi

palloma_efi

Ver Respostas

Oi Lucio! Boa noite. Tudo bem? Já tentou fazer dessa forma?

request.AddJsonBody(new {
grant_type = "client_credentials"
})

# pix
Avatar discord do usuario carvartur

carvartur

const credentials = Buffer.from(
${process.env.GN_CLIENT_ID}: ${process.env.GN_CLIENT_SECRET}
).toString('base64')

# pix
Avatar discord do usuario joao_efi

joao_efi

Algo tipo

js
let credentials = client_id + ':' + client_secret;
let auth = Buffer.from(config.data_credentials).toString('base64');

axios({
method: 'POST',
url: '${process.env.GN_ENDPOINT}/oauth/token',
headers:{
Authorization: 'Basic ${auth}',
'Content-Type': 'application/json'
},
httpsAgent: agent,
data:{
grant_type: 'client_credentials'
}

}).catch((e)=>{
console.log(e)
})

# pix
Avatar discord do usuario joao_efi

joao_efi

Boa tarde <@!442856853131755520> tudo bem? 🙂
Quando concatenou as credenciais elas foram passadas na variavel credentials para base64?

# pix
Avatar discord do usuario carvartur

carvartur

axios({
method: 'POST',
url:${process.env.GN_ENDPOINT}/oauth/token,
headers:{
Authorization:Basic ${credentials},
'Content-Type': 'application/json'
},
httpsAgent: agent,
data:{
grant_type: 'client_credentials'
}

}).catch((e)=>{
console.log(e)
})

# pix
Avatar discord do usuario rodrigojoaobertotti

rodrigojoaobertotti

Ver Respostas

Olá, boa tarde!
Quando tento configurar os webhooks, estou tendo o erro UNABLE_TO_GET_ISSUER_CERT no campo request.socket.authorizationError
tanto na primeira, quanto na segunda solicitação que o gerência net faz (a primeira é normal dar erro, certo?)

this.server = https.createServer(
{
cert: fs.readFileSync('./credentials/server.crt'),
key: fs.readFileSync('./credentials/server.key'),
ca: [
fs.readFileSync('./credentials/gerenciaNet/pix-ca-crt.pem')
],
minVersion: "TLSv1.2",
requestCert: true,
rejectUnauthorized: false,
},
this.app
);

# pix
Avatar discord do usuario jeffersonsotto

jeffersonsotto

voce diz como esta a path (caminho) do certificado, no arquivo credentials.json?