Skip to content

Commit

Permalink
Update Login resource docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Campbell committed Nov 10, 2020
1 parent 271caab commit ba3c9b7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit ba3c9b7

Please sign in to comment.