Answer the question
In order to leave comments, you need to log in
How to fix nodejs request error?
Greetings, tell me why it doesn’t work, I don’t understand, it says
{"error_description": "grant_type not in POST", "error": "invalid_request"}
what is wrong?)
var options = {
"grant_type": "authorization_code",
"code": code,
"client_id": ci,
"client_secret": cs
};
var opt = {
"url": "https://oauth.yandex.ru/token",
"method": "POST",
"headers": {
'Content-type': 'application/x-www-form-urlencoded'
},
"grant_type": "authorization_code",
"code": code,
"client_id": ci,
"client_secret": cs
};
request.post(opt, (req, res) => {
console.log(opt);
var body = res.body;
console.log(body);
});
Answer the question
In order to leave comments, you need to log in
You have a colon where a semicolon should be:
case valMetr == 0:
valMetr = 0: // <<===== ошибка, должна быть точка с запятой
break;
case valMetr>1 && valMetr<=49:
valMetr = 30: // <<===== ошибка, должна быть точка с запятой
break;
Because you're cooking it wrong. In switch you should have valMetr and in case you should have values. For intervals, switch-case is not very applicable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question