matrix-synapse

Registering a user in Matrix Synapse Server using API


I need to create a user account using Matrix Synapse Client Server API.

On matrix homeserver token-authenticated registration is enabled.

POST to <base_url>/register end-point with auth fetches two stages.

{
  "auth": {
    "type": "m.login.registration_token"
  }
}

Response

    {
        "session": "MazXdqessBZZXLCQFrDgWlqx",
        "flows": [
            {
                "stages": [
                    "m.login.registration_token",
                    "m.login.dummy"
                ]
            },
            {
                "stages": [
                    "m.login.registration_token",
                    "m.login.email.identity"
                ]
            }
        ],
        "params": {},
        "completed": [],
        "error": "Missing registration token",
        "errcode": "M_MISSING_PARAM"
    }

Error codes clarifies the missing registration token, however I would like to know how to request a registration token in the first place. The documentation is not helping.

https://spec.matrix.org/v1.3/client-server-api/#token-authenticated-registration


Solution

  • While the act of registering using a token is part of the matrix spec, the act of configuring tokens is currently left up to the homeserver implementation. Synapse's documentation for it can be found at https://matrix-org.github.io/synapse/latest/usage/administration/admin_api/registration_tokens.html