getbrevo / brevo-node

A fully-featured JavaScript API client to interact with Brevo.
https://developers.brevo.com/
ISC License
63 stars 8 forks source link

How do you even authenticate the requests? #34

Open Sebastp opened 2 months ago

Sebastp commented 2 months ago

Seriously, whoever is responsible for this docs should be forced to use it themselves.

The examples in README throw TS errors. I'm getting 401. This is unusable.. @shubhamUpadhyayInBlue @ceisele-r @aayush-sib

Guigeek973 commented 3 weeks ago

Same here for me ! The issue was that when i was using process.env and nodenv top retrieve the apik_key it return undefined and then getbrevo dont have the authorization necessary... Not the first time something like this happens for me, sometimes some packages got difficulties to access env variables i ont know why...

DONT WORK const apiInstance = new brevo.TransactionalEmailsApi(); let apiKey = apiInstance.authentications['apiKey']; apiKey.apiKey = process.env.BREVO_API_KEY;

WORKS const apiInstance = new brevo.TransactionalEmailsApi(); let apiKey = apiInstance.authentications['apiKey']; apiKey.apiKey = 'xkeysib-xxxx';