n8n-nodes-efibank
Version:
Nó personalizado para integração com as APIs Cobranças e Pix do Efibank, permitindo operações de pagamentos, recebimentos e gerenciamento de transações financeiras.
19 lines • 733 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.auth = void 0;
async function auth(credentials, baseURL, httpRequest) {
const authHeader = `Basic ${Buffer.from(`${credentials.clientId}:${credentials.clientSecret}`).toString('base64')}`;
const authResponse = await httpRequest({
method: 'POST',
url: `${baseURL}/v1/authorize`,
json: true,
headers: { Authorization: authHeader },
body: { grant_type: 'client_credentials' },
});
if (!authResponse.access_token) {
throw new Error('Autenticação falhou: token de acesso não recebido');
}
return authResponse.access_token;
}
exports.auth = auth;
//# sourceMappingURL=auth.js.map