Thread:Project:Support desk/Logging into api using mediawiki

Hi,

Mediawiki 1.22.6

I am following this code here http://www.mediawiki.org/wiki/Example_login_code_in_JS_(using_JQuery) to log in to my wiki.

The application makes proper post requests. The first post request returns 'Needs Token' and the token is returned in the json object

On the second request even though I am supplying the token with the username and password. It returns an error, and the result still remains Result : Need Token.

This is the first request

"http://upgrade.vaniquotes.org/w.1.22/api.php?action=login&lgname=Test&lgpassword=test123&format=json"

This is the second request

"http://upgrade.vaniquotes.org/w.1.22/api.php?action=login&lgname=Test&lgpassword=test123&lgtoken=a037a59d881bbc48ce54951d009284ce&format=json""

Is there anything extra that needs to be done for mediawiki 1.22.6 ? The code seems correct. I am not able to figure put why it enters the code block for the first else condition.

Please help! SOS!

Arnab