开发者

Getting an edit token for a mediaWiki fauxRequest

I am using mediaWiki's fauxRequest to do internal API calls. But I need an edit token to do it. I thought this would work, and it does report back a token, nit the request says it is a 'badtoken: Invalid token'

global $wgRequest;
$token = $wgRequest->getSessionData( 'wsEditToken' );

Any ideas?

I just noticed when I logout, the token it gives me is the same token as when I log in. Seems like this method is not looking at my session when it attempts to get the token.


I am not allowed to answer my own question yet, so here it is.

I was lead astray by bad exampl开发者_如何学运维es. The answer was very easy.

global $wgUser;
$wgUser->editToken();


I was lead astray by bad examples. The answer was very easy.

global $wgUser; $wgUser->editToken();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜