import requests
data = {
'grant_type': ***,
'client_id': ***,
'client_secret': ***
}
url = ***
token = requests.post(url, data).json()['access_token']
var url = ***
var token = await fetch(url, {
'method': 'POST',
'grant_type': ***,
'client_id': ***,
'client_secret': ***
}).then(r => r.json()['access_token']);
var url = 'https://адрес_запроса';
var data = {
'grant_type': ***,
'client_id': ***,
'client_secret': ***
};
var response = await (await fetch(url, {
'method': 'POST',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
},
'body': new URLSearchParams(data).toString()
})).json();
console.log('Ответ сервера:');
console.dir(response);
console.log('Токен:');
console.dir(response['access_token']);