Why am I getting an authentication error when using a Mailerlite integration with node.js?

This topic was automatically generated from Slack. You can find the original thread here.

Hey, I am trying a Mailerlite integration, but the node.js setup spits out an authentication error before I even edit the code. Note, I have input the proper key because the pre-built options (e.g. List Subscribers) work fine. Only the custom code option spits an error that I can’t seem to resolve. Thank you.

image.png

Tim - I was able to reproduce with my own MailerLite account. When I logged into Mailerlite, it is clear they have iterated on the app and there are two modes where I was forced to select one. Once I selected that and created a new API key, it now works. For some reason the prior key I used to build this integration in the first place was no longer valid.

With my original key, I got the same error you did. With my new key, this is what I got:

Tod, do we need to update the test request?

The test worked with my new api key. In my case at least, the key was expired somehow. It appeared MailerLite had killed it.

Interesting… thank you for the fix!

Fyi this is due to there being 2 versions of the MailerLite api. Apparently the node.js option in PD defaults to v1, whereas I am authenticated for v2.

Are you still seeing the v1 in the default Node step for Mailerlite? I am seeing https://connect.mailerlite.com/api/campaigns, which is from their v2 docs

Sheesh, sorry, not quite sure what MailerLite is on. But this is the endpoint that works for my ML key:

It appears to be v1, but is labeled as v2 in link? -_-

e.g. https://api.mailerlite.com/api/v2/campaigns/{status}

Apparently there is MailerLite, and MailerLite classic. Might need 2 separate instances in PD to account for this.

Posted thread to Discourse: What is causing the authentication error with Mailerlite integration in node.js?