Skip to content Skip to sidebar Skip to footer

Media Wiki Second Post Still Returns Needtoken Result

After first POST request I get 'NeedToken' result then in my second POST request I pass token and sessionid as parameters. Here is my Javascript code: function wiki_auth(login, pa

Solution 1:

You will need to actually POST the parameters as data (in the body of the HTTP request), not append them to the GET parameters in the url. Use

$.post(ref+'api.php?action=login&format=json', {
    lgname: login,
    lgpassword: pass,
    lgtoken: data.login.token,
    sessionid: data.login.sessionid,
    lgdomain: ref
}, function(data) {  });

Post a Comment for "Media Wiki Second Post Still Returns Needtoken Result"