K
K
KirylLapouski2018-05-20 11:25:10
JavaScript
KirylLapouski, 2018-05-20 11:25:10

An error occurred while sending a post request to get a token. How to fix?

Sending a request:

var request = require('request');
  request.post('https://oauth.yandex.ru/token', {
    'grant_type': 'authorization_code',
    'code': req.query.code,
    'client_id': 'c48956d9f59442bab960f373a6ca5ba2',
    'client_secret': '9e46f2c8fefb4f55bf63b06066431c4d',
  }, function(err, httpResponse, body) {
    console.log(body);
  });

Error
5b01307d0a629793876151.png
In postman, the same request works fine
5b0130e4c9bf4630565612.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question