Set up access tokens

Guidelines for including the access token fetched from the authentication page in the request.

const axios = require('axios');

const ACCESS_TOKEN = 'YOUR_ACCESS_TOKEN_HERE';
const REQUEST_PATH = 'ANY_PATH';

const headers = {
  'EXCOINZ_SECRET': `${SECRET_KEY}`,
  'Authorization': `Bearer ${ACCESS_TOKEN}`,
  'Content-Type': 'application/json'
};

const data = {
  //ANY_DATA
};

axios.post(`https://api.excoinz.com/${REQUEST_PATH}`, data, { headers: headers })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error.response.data);
  });

If you don't include an access token in the request, the user will have to log in anew each time.

Last updated