I'm generating an authorization link:
var url = `https://slack.com/oauth/authorize?client_id=*****.*****&redirect_uri=http://localhost:6001/code/slack&state=${state}&scope=channels:read,bot`
In the redirect endpoint:
var url = 'https://slack.com/api/oauth.v2.access';
  var data = {
    'grant_type': 'authorization_code',
    'client_id': "*****.******",
    'code': req.query.code,
    'redirect_uri': 'http://localhost:6001/code/slack'
  };
  axios.post(url, data, {
    headers: {
      'Content-Type': 'application/json; charset=utf-8'
    }
  }).then((response: any) => {
    console.log(response.data)
  }).catch((error: any) => {
    res.status(400).json(error.response.data);
  });
However, when I'm receiving this error for some reason { ok: false, error: 'invalid_code' }
Could it be because I have a http redirect point? I don't think so because I'm able to receive the code and state in the request.