swagger: add logout endpoint

master
ALI Hamza 2020-09-09 22:21:57 +07:00
parent 0dde95ee8e
commit 56e575ed7c
Signed by: hamza
GPG Key ID: 22473A32291F8CB6
1 changed files with 40 additions and 0 deletions

@ -28,6 +28,26 @@ paths:
$ref: '#/components/responses/InvalidCredentials' $ref: '#/components/responses/InvalidCredentials'
500: 500:
$ref: '#/components/responses/ServerError' $ref: '#/components/responses/ServerError'
/auth/logout:
post:
tags:
- Auth Endpoints
summary: Logs out a user, making their access token invalid.
requestBody:
$ref: '#/components/requestBodies/TokenRequest'
responses:
200:
description: You have successfully logged out, and your token is now invalid.
content:
application/json:
schema:
type: object
400:
$ref: '#/components/responses/MalformedBody'
401:
$ref: '#/components/responses/InvalidToken'
500:
$ref: '#/components/responses/ServerError'
components: components:
requestBodies: requestBodies:
@ -48,6 +68,17 @@ components:
password: password:
type: string type: string
description: The password of the user. description: The password of the user.
TokenRequest:
description: The access token to identify a user.
content:
application/json:
schema:
required:
- token
properties:
token:
type: string
description: The access token.
responses: responses:
MalformedBody: MalformedBody:
description: The information in your body is incomplete, or your JSON format is invalid. description: The information in your body is incomplete, or your JSON format is invalid.
@ -67,6 +98,15 @@ components:
example: example:
reason: The username or password provided are incorrect. reason: The username or password provided are incorrect.
code: 401 code: 401
InvalidToken:
description: The access token you provided is invalid or missing.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
reason: The token provided is invalid.
code: 401
ServerError: ServerError:
description: The server could not complete a request due to an unknown error. More informatino may be available in the description. description: The server could not complete a request due to an unknown error. More informatino may be available in the description.
content: content: