From ba3c9b7cdd2bef8f459596c7f282669fc4236f12 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Tue, 10 Nov 2020 15:22:57 -0500 Subject: [PATCH] Update Login resource docs --- api/api.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/api/api.py b/api/api.py index 12829a1..b29b4f6 100644 --- a/api/api.py +++ b/api/api.py @@ -45,7 +45,24 @@ class Login(Resource): - def post(self): + def post(self) -> tuple: + """Validates username/password and returns both access and refresh tokens. + + Return Codes: + 200 (OK): On success. + 401 (Unauthroized): When username or password are incorrect. + 422 (Unprocessable Entitiy): When the username or password can't be parsed. + + Example: + curl -X POST + -H "Content-Type: application/json" + -d '{"username": "bob", "password": "super_secret"}' + + { "access_token": fjr09hfp09h932jp9ruj3.3r8ihf8h0w8hr08ifhj804h8i.8h48ith08ity409hip0t4 } + + Returns: + tuple: Response containing tokens and HTTP response code. + """ if not request.is_json: return ({ "message": "JSON missing from request body"}, 422)