profile
viewpoint

Ask questionsNode.js Axios HTTP request with bearer token returning undefined

Hello,

I'm a little new to Node.js, so I hope this question isn't too basic. I'm working with Node.js/Axios, and trying to get basic communication going with the Tiltify API. Here's my code so far:

const axios = require('axios');

axios.get('URL_GOES_HERE', {
  headers: {
    'Authorization' : 'Bearer MY_TILTIFY_ACCESS_TOKEN'
  }
})
  .then(response => {
    console.log(response.data.url);
    console.log(response.data.explanation);
  })
  .catch(error => {
    console.log(error);
  });

I assume that MY_TILTIFY_ACCESS_TOKEN is the access token I generated from within my Tiltify account. I'm confused, however, about what value to put in URL_GOES_HERE. The API docs give two possible URLS: https://tiltify.com/oauth/authorize and https://tiltify.com/oauth/token. Or am I supposed to put my bearer credentials directly into the URL of a useful request, like https://tiltify.com/api/v3/user? I've tried all three, and I just get undefined undefined in the console.

Thanks for taking a look!

Tiltify/api

Answer questions benstepp

You can just use the application access token directly on useful requests, no need to use the oauth2 urls if you're just building something simple

axios.get('https://tiltify.com/api/v3/campaigns/65218', {
  headers: {
    'Authorization': 'Bearer 5934AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
  }
})

api/v3/user is returning nothing, because we treat application access tokens as if you were viewing the website publicly without being signed in.

useful!

Related questions

No questions were found.
source:https://uonfu.com/
Github User Rank List