API:Login/es

MediaWiki API puede requerir que tu aplicación o cliente proporcione credenciales de usuario autenticado e inicie sesión para (a) consultar información o acciones de modificación-de-datos (b) realizando grandes consultas con un mayor límite de solicitud.

Dos métodos para autenticar
Hay dos maneras para autenticar al MediaWiki Acción API:

Método 1. login
Bots and other non-interactive applications should use owner-only OAuth consumers if available as it is more secure. If not available or not applicable to the client, the  action may be used with bot passwords.

Método 2. clientlogin
Las aplicaciones interactivas, como editores personalizados o aplicaciones de vigilancia que proporcionan un servicio sin intención de reemplazar completamente el sitio web o las aplicaciones móviles que apuntan a reemplazar completamente el acceso a la interfaz de usuario basada en la web, tendrían que utilizar la acción. However, one should prefer using if it is available for authenticating the tool, as it is easier and more secure. This module is available since MediaWiki 1.27.

POST request
Obtain token login in the request above via.

Example 2: Process for a wiki with special authentication extensions
A wiki with special authentication extensions such as (captchas),,  (two factor authentication), may have a more complicated authentication process. Specific fields might also be required in that case, the description of which could be fetched from the query.

Step 3: Two-factor authentication
Note: In certain cases it's possible to receive a  response, for example if the OpenID Connect extension had no mapping for the OpenID account to any local user. In this case the client might restart the login process from the beginning or might switch to account creation, in either case passing the loginpreservestate or createpreservestate parameter to preserve some state.

Additional notes

 * On wikis that allow anonymous editing, it's possible to edit through the API without logging in, but it's highly recommended that you do log in. On private wikis, logging in is required to use any API functionality.
 * It is recommended to create a separate user account for your application. This is especially important if your application is carrying out automated editing or invoking large or performance-intensive queries. With that, it is easy to track changes made by the application and apply special rights to the application's account.
 * If you are sending a request that should be made by a logged-in user, add  parameter to the request you are sending in order to check whether the user is logged in. If the user is not logged-in, an   error code will be returned.
 * To check if an account has bot rights, add  parameter to the request. If the account does not have bot rights, an   error code will be returned.

Ve también

 * - Returns information about the currently logged-in user
 * Interactive login with action=clientlogin in mwapi