An ebook/comic library service and web client
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.5 KiB

  1. Authentication API
  2. ==================
  3. .. http:post:: /auth/login
  4. Authenticate with the server and receive a userToken for requests.
  5. **Example request**:
  6. .. sourcecode:: http
  7. POST /auth/login HTTP/1.1
  8. Host: example.tld
  9. Accept: application/json
  10. Authorization: Basic <Base64 Encoded Basic Auth>
  11. **Example response**:
  12. .. sourcecode:: http
  13. HTTP/1.1 200 OK
  14. Vary: Accept
  15. Content-Type: application/json
  16. {
  17. "creationTime": "2018-07-29T11:59:29-05:00",
  18. "enabled": true,
  19. "token": "b94cf5c7-cddc-4610-9d4c-6b8e04088ae8",
  20. "version": 0
  21. }
  22. :reqheader Accept: the response content type depends on :mailheader:`Accept` header
  23. :reqheader Authorization: The encoded basic authorization
  24. :resheader Content-Type: this depends on :mailheader:`Accept` header of request
  25. :statuscode 200: user successfully logged in
  26. :statuscode 401: authorization failed
  27. .. http:post:: /auth/bump
  28. Bump user login information.
  29. **Example request**:
  30. .. sourcecode:: http
  31. POST /auth/bump HTTP/1.1
  32. Host: example.tld
  33. Accept: application/json
  34. Authorization: Token <Base64(user:userToken)>
  35. **Example response**:
  36. .. sourcecode:: http
  37. HTTP/1.1 200 OK
  38. Vary: Accept
  39. Content-Type: application/json
  40. {
  41. "lastLoginTime": "2018-07-29T12:15:51-05:00"
  42. }
  43. :reqheader Accept: the response content type depends on :mailheader:`Accept` header
  44. :reqheader Authorization: The encoded basic authorization
  45. :resheader Content-Type: this depends on :mailheader:`Accept` header of request
  46. :statuscode 200: user last_login_time successfully bumped
  47. :statuscode 401: authorization failed
  48. .. http:post:: /auth/logout
  49. Logout a user and remove the provided userToken from valid tokens.
  50. **Example request**:
  51. .. sourcecode:: http
  52. POST /auth/logout HTTP/1.1
  53. Host: example.tld
  54. Accept: application/json
  55. Authorization: Token <Base64(user:userToken)>
  56. **Example response**:
  57. .. sourcecode:: http
  58. HTTP/1.1 200 OK
  59. Vary: Accept
  60. Content-Type: application/json
  61. {
  62. "success": true
  63. }
  64. :reqheader Accept: the response content type depends on :mailheader:`Accept` header
  65. :reqheader Authorization: The encoded basic authorization
  66. :resheader Content-Type: this depends on :mailheader:`Accept` header of request
  67. :statuscode 200: user successfully logged out
  68. :statuscode 401: authorization failed