Page MenuHomePhabricator

https://www.mediawiki.org/wiki/API:Account_creation confusing - examples and details missing
Open, Needs TriagePublic

Description

From MW 1.27 on there has been a design decision to change the Account creation API to make it more flexible.

As outlined in https://www.mediawiki.org/wiki/Topic:V8v99p6xookam0ig when using the API in "old style" an error message

Unrecognized parameters: mailpassword, reason, email, username, realname.

is returned which is not part of the https://www.mediawiki.org/wiki/API:Account_creation#Possible_errors

When looking at the examples it is not clear what the steps are to get the "old style" functionality back.

Doing a &meta=authmanagerinfo&amirequestsfor=create request on my MW 1.31 test wiki returned the following json below. It is not clear from the documentation how to use this information to get the "old style" functionality back.

I'd recommend to reintroduced the old api as a default e.g. by adding a parameter and doing the new style complicated stuff in the background to hide the introduced complexity for those who do not need it.

{
  "batchcomplete": "",
  "query": {
    "authmanagerinfo": {
      "canauthenticatenow": "",
      "cancreateaccounts": "",
      "preservedusername": "",
      "requests": [{
        "id": "MediaWiki\\Auth\\TemporaryPasswordAuthenticationRequest",
        "metadata": {},
        "required": "primary-required",
        "provider": "Temporary password",
        "account": "",
        "fields": {
          "mailpassword": {
            "type": "checkbox",
            "label": "Use a temporary random password and send it to the specified email address",
            "help": "Can be used to create account for another person without learning the password."
          }
        }
      }, {
        "id": "MediaWiki\\Auth\\PasswordAuthenticationRequest",
        "metadata": {},
        "required": "primary-required",
        "provider": "Password-based authentication",
        "account": "",
        "fields": {
          "username": {
            "type": "string",
            "label": "Username",
            "help": "Username for authentication."
          },
          "password": {
            "type": "password",
            "label": "Password",
            "help": "Password for authentication.",
            "sensitive": ""
          },
          "retype": {
            "type": "password",
            "label": "Retype password:",
            "help": "Password again to confirm.",
            "sensitive": ""
          }
        }
      }, {
        "id": "MediaWiki\\Auth\\UsernameAuthenticationRequest",
        "metadata": {},
        "required": "required",
        "provider": "MediaWiki\\Auth\\UsernameAuthenticationRequest",
        "account": "MediaWiki\\Auth\\UsernameAuthenticationRequest",
        "fields": {
          "username": {
            "type": "string",
            "label": "Username",
            "help": "Username for authentication."
          }
        }
      }, {
        "id": "MediaWiki\\Auth\\UserDataAuthenticationRequest",
        "metadata": {},
        "required": "required",
        "provider": "MediaWiki\\Auth\\UserDataAuthenticationRequest",
        "account": "MediaWiki\\Auth\\UserDataAuthenticationRequest",
        "fields": {
          "email": {
            "type": "string",
            "label": "Email",
            "help": "Email address",
            "optional": ""
          },
          "realname": {
            "type": "string",
            "label": "Real name",
            "help": "Real name of the user",
            "optional": ""
          }
        }
      }, {
        "id": "MediaWiki\\Auth\\CreationReasonAuthenticationRequest",
        "metadata": {},
        "required": "optional",
        "provider": "MediaWiki\\Auth\\CreationReasonAuthenticationRequest",
        "account": "MediaWiki\\Auth\\CreationReasonAuthenticationRequest",
        "fields": {
          "reason": {
            "type": "string",
            "label": "Reason",
            "help": "Message shown in the account creation log"
          }
        }
      }]
    }
  }
}