Merge pull request #45 from matrix-org/daniel/swaggerlogin

Swaggerify /login
pull/977/head
Kegsay 9 years ago
commit 916046670c

@ -0,0 +1,79 @@
swagger: '2.0'
info:
title: "Matrix Client-Server v1 Registration and Login API"
version: "1.0.0"
host: localhost:8008
schemes:
- https
- http
basePath: /_matrix/client/api/v1
consumes:
- application/json
produces:
- application/json
securityDefinitions:
accessToken:
type: apiKey
description: The user_id or application service access_token
name: access_token
in: query
paths:
"/login":
post:
summary: Authenticates the user.
description: |-
Authenticates the user by password, and issues an access token they can
use to authorize themself in subsequent requests.
security:
- accessToken: []
parameters:
- in: body
name: body
required: true
schema:
type: object
example: |-
{
"username": "cheeky_monkey",
"password": "ilovebananas"
}
properties:
username:
type: string
description: The fully qualified user ID or just local part of the user ID, to log in.
password:
type: string
description: The user's password.
required: ["username", "password"]
responses:
200:
description: The user has been authenticated.
examples:
application/json: |-
{
"user_id": "@cheeky_monkey:matrix.org",
"access_token": "abc123",
"home_server": "matrix.org"
}
schema:
type: object
properties:
user_id:
type: string
description: The fully-qualified Matrix ID that has been registered.
access_token:
type: string
description: An access token for the account. This access token can then be used to authorize other requests.
home_server:
type: string
description: The hostname of the Home Server on which the account has been registered.
403:
description: |-
The login attempt failed. For example, the password may have been incorrect.
examples:
application/json: |-
{"errcode": "M_FORBIDDEN"}
429:
description: This request was rate-limited.
schema:
"$ref": "definitions/error.yaml"

@ -1011,32 +1011,7 @@ was registered whilst the client was performing authentication.
Old V1 API docs: |register|_
Login
~~~~~
This section refers to API Version 1.
API docs: |login|_
Obtaining an access token for an existing user account is done using the
request::
POST $PREFIX/login
The body of the POST request is a JSON object containing:
username
The full qualified or local part of the Matrix ID to log in with.
password
The password for the account.
On success, this returns a JSON object with keys:
user_id
The fully-qualified Matrix ID that has been registered.
access_token
An access token for the new account.
home_server
The hostname of the Home Server on which the account has been registered.
{{login_http_api}}
Changing Password
~~~~~~~~~~~~~~~~~

@ -96,6 +96,12 @@ class MatrixSections(Sections):
title_kind="~"
)
def render_login_http_api(self):
return self._render_http_api_group(
"login",
title_kind="~"
)
def render_room_events(self):
def filterFn(eventType):
return (

Loading…
Cancel
Save