On Tue, May 16, 2017 at 2:26 PM, Guangyao_Cheng <guangyao(a)nfs.iscas.ac.cn>
wrote:
I try to auto-login mediawiki by API login,but
didn't know how to do.Since
I already used login api get "success" status on sandbox, I think maybe I
do something wrong on set cookie.Get token and login api has been revamped
in version 1.27 of MediaWiki,I can't find any example code work on
1.28.Thanks for all responses and suggestion. I've been stuck for so long.
I really appreciate some help here. Thanks.
You are not setting any cookie that would authenticate the user (just
setting username + ID is not enough for obvious reasons). You should
probably just use a cookie jar instead of trying to reimplement cookie
handling manually.
Also you should properly encode things (what happens if the password
contains an & character?)
I also try to use clientlogin via postman, post request exactly like
example on
mediawiki.org/wiki/API:Login ,but result:
"authmanager-authn-no-primary".
That means you have not submitted any set of credentials that would be
meaningful for login (such as a username + password). That or the wiki is
misconfigured in some weird way and there is no way to log in at all (but
you'd notice that when logging in manually).