Bom dia! Estou tentando fazer a requisiçao de obter a autorizaçao no node igual na documentaçao, porem estou tomando um 401
ts
const credentials = {
client_id: process.env.EFI_CLIENT_ID,
client_secret: process.env.EFI_CLIENT_SECRET,
};
export const getCobrancasAuthorization = async () => {
const data = JSON.stringify({ grant_type: 'client_credentials' });
const data_credentials =
credentials.client_id + ':' + credentials.client_secret;
const auth = Buffer.from(data_credentials).toString('base64');
const config = {
method: 'POST',
url: '
https://cobrancas-h.api.efipay.com.br/v1/authorize',
headers: {
Authorization: 'Basic ' + auth,
'Content-Type': 'application/json',
},
data: data,
};
try {
const response = await axios(config);
return response.data;
} catch (error) {
console.log(error);
}
};