API:Login

Login gets several tokens that are needed by the server to recognize logged-in user. In every call to api.php, the cookie set by this request must be passed.

Example request
Note: In this example, all parameters are passed in a GET request just for the sake of simplicity. However, action=login requires POST requests; GET requests will cause an error.

You might need to add the query parameter, containing your domain name for authentication, if you're  using an authentication plug-in like Extension:LDAP Authentication.

Constructing cookies manually
Since the CentralAuth extension has been enabled, the API does not pass enough return parameters to construct the cookies. The only way to access them is to retrieve the  headers from the API's returned page.

Errors
Errors are returned in the result field. Possible values are:
 * You didn't set the lgname parameter
 * You provided an illegal username
 * The username you provided doesn't exist
 * You didn't set the lgpassword parameter or you left it empty
 * The password you provided is incorrect
 * Same as, returned when an authentication plugin rather than MediaWiki itself rejected the password
 * The wiki tried to automatically create a new account for you, but your IP address has been blocked from account creation
 * You've logged in too many times in a short time. See also throttling
 * The password you provided is incorrect
 * Same as, returned when an authentication plugin rather than MediaWiki itself rejected the password
 * The wiki tried to automatically create a new account for you, but your IP address has been blocked from account creation
 * You've logged in too many times in a short time. See also throttling
 * The wiki tried to automatically create a new account for you, but your IP address has been blocked from account creation
 * You've logged in too many times in a short time. See also throttling
 * You've logged in too many times in a short time. See also throttling
 * You've logged in too many times in a short time. See also throttling

Throttling
For security reasons, this module is throttled. By default, you get to login 5 times in 300 seconds, but this may vary from one wiki to another. When you exceed this limit, your login will fail (even if it's otherwise correct) with  and the number of seconds you need to wait in the   field.