Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki

MediaWiki API help: cannot get a token after login

 

 

Wikipedia mediawiki RSS feed   Index | Next | Previous | View Threaded


danb at VistaPrint

May 21, 2008, 7:59 AM

Post #1 of 5 (297 views)
Permalink
MediaWiki API help: cannot get a token after login

I'm trying out the MediaWiki API and cannot seem to obtain a token (say, a "move" token) after a successful login. Can anyone help? Here is what I've tried. This is MediaWiki 1.12.0 on Windows 2003 Server (Apache 2.2.8, MySQL 5, PHP 5.2.5).

I do have:

$wgEnableWriteAPI = true;

My script runs on the command line. Login succeeds, giving me a login token, when I POST with these parameters:

api.php?action=login&lgname=tester&lgpassword=123456&format=xml

and get back:

<?xml version="1.0" encoding="utf-8"?>
<api>
<login result="Success"
lguserid="123"
lgusername="tester"
lgtoken="eedcad0fa714033528290183da251af8"
cookieprefix="wikidb_mw_"
sessionid="lldh5t86b3vbeccpeda46s5ep6" />
</api>

But when I try to get a Move token via POST:

api.php?action=query&prop=info&intoken=move&titles=my+new+page&lgtoken=eedcad0fa714033528290183da251af8&format=xml

I get:

<?xml version="1.0" encoding="utf-8"?>
<api>
<error code="inpermissiondenied"
info="Action &#039;move&#039; is not allowed for the current user" />
</api>

Strangely, if I paste the "move token" URL into a web browser, instead of running a script on the command line, I get different results:

<api>
<query>
<normalized>
<n from="my new page" to="My new page"/>
</normalized>
<pages>
<page ns="0" title="My new page" missing=""/>
</pages>
</query>
</api>

but still no Move token.

Any ideas?
Thanks!
DanB

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


danb at VistaPrint

May 21, 2008, 12:53 PM

Post #2 of 5 (288 views)
Permalink
Re: MediaWiki API help: cannot get a token after login [In reply to]

Same problem happens in 1.13. (I'm using 1.12 below.)

DanB

-----Original Message-----
From: mediawiki-l-bounces[at]lists.wikimedia.org [mailto:mediawiki-l-bounces[at]lists.wikimedia.org] On Behalf Of Daniel Barrett
Sent: Wednesday, May 21, 2008 11:00 AM
To: MediaWiki announcements and site admin list
Subject: [Mediawiki-l] MediaWiki API help: cannot get a token after login

I'm trying out the MediaWiki API and cannot seem to obtain a token (say, a "move" token) after a successful login. Can anyone help? Here is what I've tried. This is MediaWiki 1.12.0 on Windows 2003 Server (Apache 2.2.8, MySQL 5, PHP 5.2.5).

I do have:

$wgEnableWriteAPI = true;

My script runs on the command line. Login succeeds, giving me a login token, when I POST with these parameters:

api.php?action=login&lgname=tester&lgpassword=123456&format=xml

and get back:

<?xml version="1.0" encoding="utf-8"?>
<api>
<login result="Success"
lguserid="123"
lgusername="tester"
lgtoken="eedcad0fa714033528290183da251af8"
cookieprefix="wikidb_mw_"
sessionid="lldh5t86b3vbeccpeda46s5ep6" />
</api>

But when I try to get a Move token via POST:

api.php?action=query&prop=info&intoken=move&titles=my+new+page&lgtoken=eedcad0fa714033528290183da251af8&format=xml

I get:

<?xml version="1.0" encoding="utf-8"?>
<api>
<error code="inpermissiondenied"
info="Action &#039;move&#039; is not allowed for the current user" />
</api>

Strangely, if I paste the "move token" URL into a web browser, instead of running a script on the command line, I get different results:

<api>
<query>
<normalized>
<n from="my new page" to="My new page"/>
</normalized>
<pages>
<page ns="0" title="My new page" missing=""/>
</pages>
</query>
</api>

but still no Move token.

Any ideas?
Thanks!
DanB

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


Platonides at gmail

May 21, 2008, 1:30 PM

Post #3 of 5 (286 views)
Permalink
Re: MediaWiki API help: cannot get a token after login [In reply to]

Daniel Barrett wrote:
> Same problem happens in 1.13. (I'm using 1.12 below.)
>
> DanB

You can probably get better answer by posting to the mediawiki-api
mailing list. Although the ones actually able to answer it (likely
Roan?) will also be reading this list.
There have been changes very recently to how the token asking fails.
It's probably unrelated to this problem, but worth noting.


_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


onekopaka at gmail

May 21, 2008, 4:23 PM

Post #4 of 5 (283 views)
Permalink
Re: MediaWiki API help: cannot get a token after login [In reply to]

a move token is likely restricted by user rights.
Seeing as that the reply contains "permissiondenied", that is probably
the cause.

On May 21, 2008, at 1:30 PM, Platonides wrote:

> Daniel Barrett wrote:
>> Same problem happens in 1.13. (I'm using 1.12 below.)
>>
>> DanB
>
> You can probably get better answer by posting to the mediawiki-api
> mailing list. Although the ones actually able to answer it (likely
> Roan?) will also be reading this list.
> There have been changes very recently to how the token asking fails.
> It's probably unrelated to this problem, but worth noting.
>
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l[at]lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Darren VanBuren
onekopaka[at]gmail.com
----------------------------------------------
Administrator of Onekopakaspace




_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


danb at VistaPrint

May 22, 2008, 8:43 AM

Post #5 of 5 (273 views)
Permalink
Re: MediaWiki API help: cannot get a token after login [In reply to]

Thanks everyone, I didn't know there was a mediawiki-api mailing list. I found my answer in its archives:

https://lists.wikimedia.org/mailman/htdig/mediawiki-api/2007-November/000213.html

which indicates that the docs are incorrect (not updated yet).

DanB

-----Original Message-----
> You can probably get better answer by posting to the mediawiki-api
> mailing list.

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Wikipedia mediawiki RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.