API:Account creation/es

Crear una cuenta
El proceso tiene tres pasos generales:


 * 1) Obtén los campos de  y el token de.
 * 2) Envías una solicitud POST con el token obtenido, información de usuario y otros campos, y devuelve URL a la API.
 * 3) Trata la respuesta, lo que podría implicar más solicitudes POST para proporcionar más información.

Ejemplo 1: Procesar en un wiki sin extensiones especiales de autenticación
Un wiki sin extensiones de autentificación especial puede ser bastante sincero. If your code knows which fields will be required, it might skip the call to and just assume which fields will be needed (i.e. username, password &amp; retyped password, email, possibly realname).

Example 2: Process on a wiki with a CAPTCHA extension
Note the first step below could, if you'd rather, be done as two steps: one to fetch the fields available from and another to fetch the token from.

Código de ejemplo
Note this code sample separates the and  requests, and generally assumes there will be a CAPTCHA and no other complications.

First step: Fetch fields available from and token from
The fetching of and  is largely the same as in the previous example, and so is not repeated here. The list of requests returned by will include definitions for both the CAPTCHA extension and the OpenID extension.

Second step: Answer the CAPTCHA and select OpenID authentication.
The client would be expected to redirect the user's browser to the provided redirecttarget.

The OpenID provider would authenticate, and redirect to Special:OpenIDConnectReturn on the wiki, which would validate the OpenID response and then redirect to the createreturnurl provided in the first POST to the API with the code and state parameters added.

The client gets control of the process back at this point and makes its next API request.

Third step: Back from OpenID.
The client posts the code and state back to the API. The API's response has the two-factor authentication extension prompting the user to set up their second factor.

Now the client would prompt the user to set up a new account in their two-factor authentication app and enter the current code, or allow the user to skip 2FA setup. Let's assume the user does set up 2FA.

Fourth step: Set up two-factor authentication.
The account creation has finally succeeded.

If at any point account creation fails, a response with status FAIL will be returned, along with a message to display to the user.

Documentos adicionales

 * La creación de cuentas se registra en Special:log/newusers.

Si has iniciado sesión, tu nombre de usuario también se registrará al crear una cuenta.


 * While executing the code snippets provided on this page, remember:
 * Once an account on a wiki is created, it cannot be deleted.
 * Always use as the endpoint, so that you don't accidentally create accounts on production wikis.
 * MediaWiki site administrators and extension developers can disable this API feature by inserting the following line in the configuration file: