37 $token = $params[
'token'];
38 $maxage = $params[
'maxtokenage'];
48 $this->
addWarning(
'apiwarn-checktoken-percentencoding' );
51 if ( $tokenObj->match( $token, $maxage ) ) {
52 $res[
'result'] =
'valid';
53 } elseif ( $maxage !==
null && $tokenObj->match( $token ) ) {
54 $res[
'result'] =
'expired';
56 $res[
'result'] =
'invalid';
62 $mwts->timestamp->setTimestamp( $ts );
63 $res[
'generated'] = $mwts->getTimestamp( TS_ISO_8601 );
73 ParamValidator::PARAM_REQUIRED =>
true,
76 ParamValidator::PARAM_TYPE =>
'string',
77 ParamValidator::PARAM_REQUIRED =>
true,
78 ParamValidator::PARAM_SENSITIVE =>
true,
81 ParamValidator::PARAM_TYPE =>
'integer',
88 'action=checktoken&type=csrf&token=123ABC'
89 =>
'apihelp-checktoken-example-simple',
94 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Checktoken';
99class_alias( ApiCheckToken::class,
'ApiCheckToken' );