Home javascript Working with Donation Alerts API and NodeJS

Working with Donation Alerts API and NodeJS

Author

Date

Category

There is no detailed documentation on the donation alerts website. I tried to do it myself, in the end I still don’t understand how to log in through api. The only thing that gives out is {"message": "Unauthenticated."}

Code example:

const axios = require ('axios');
axios.get ('https://www.donationalerts.com/api/v1/alerts/donations', {
  params: {
    'Authorization Bearer': 'tokenSample123456789'
  }
})
 .then (response = & gt; {
  console.log (response.data.url);
  console.log (response.data.explanation);
 })
 .catch (error = & gt; {
  console.log (error);
 });

I made requests using axios because otherwise it returned undefined. Please help me figure out their api


Answer 1

Everything seems to be described in detail: https://www.donationalerts.com/apidoc#authorization__scopes

Absolutely standard authorization, no different from other OAuths.


Answer 2

So you’re not sending the header correctly, you need to write Bearer into the value, not into the key.

params: {
  'Authorization': 'Bearer tokenSample123456789'
}

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions