0
나는 mediawiki API에 데이터를 게시하려고하는데 보내려는 토큰을 인식하지 못합니다.mediawiki API에 대한 게시물 요청
var data = querystring.stringify({
action: "createaccount",
name: "sean",
email: "xxx",
password: "test",
token: "66cde5ad831521fe9d0fe4df3a2db25f"
});
var options = {
host: '54.201.91.132',
port: 80,
path: '/wiki/api.php',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(data)
}
};
var req = http.request(options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log("body: " + chunk);
});
});
req.write(data);
req.end();
우체부 크롬 확장을 사용하여 동일한 데이터를 보내려고했지만 정상적으로 작동합니다.
POST /wiki/api.php HTTP/1.1
Host: 54.201.91.132
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
action=createaccount&name=shamus&email=xxx&password=test&token=5dc9c943ac3255f87dc7782c24f61ac6&format=json
{
"createaccount": {
"username": "Shamus",
"userid": 22,
"token": "c3744c0f19ea62f6baf89b10f7c86f7f",
"result": "success"
}
}
내가 잘못하고있는 아이디어가 있습니까?
어디에서 토큰을 얻었습니까? – Bergi