Hello list,

I've read many posts around this error but I cannot figure out why I did not get it.
I hope you can shine a light to it, please.

My system: MW 1.21.1
I use AUTH_REMOTEUSER modul and its working fine.
It seems that it works with the api.php too. (fetching info with my user rights)

Well,  referring to http://en.wikipedia.org/w/api.php
I want to do the action=edit to create or edit pages.

So I start to fetch my login token.
wget --http-user=myuser --http-password=mypwd "https://localhost/wiki/api.php?action=query&prop=info|revisions&intoken=edit&titles=mynewpage&format=xml

then I get the xml back

... <page ns="0" title="mynewpage" missing="" starttimestamp="2013-09-26T21:38:59Z" edittoken="396fb7fbd9a308620d460e92e611d100+\" /></pages> ...

So I extract this edittoken-element and simply create a new page.
($newtoken=edittoken)

wget --http-user=myuser --http-password=mypwd --header="Content-Type: application/x-www-form-urlencoded" "https://localhost/wiki/api.php" --post-data "action=edit&title=mynewpage&text=test&token=$newtoken"

I get back:
error code=&quot;badtoken&quot; info=&quot;Invalid token&quot;

After investigation I found a webpage
https://www.mediawiki.org/wiki/API:Edit

which describes the token characters (The token that you received is terminated with +\, this needs to be urlencoded (so it will end with %2B%5C) before it is passed back)

I tried it with this hint and without it....  but with no success....
I also tried to do a normal login (action=login) but it does not help.

For information... my user does not have any password because of active directory authentication by the webserver. So I can not add the parameter lgname=myuser&lgpassword ....

Please can you help me?

Thank you very much!
Andreas