tokens.json 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. {
  2. "$schema": "http://json-schema.org/draft-07/schema#",
  3. "$id": "endpoints/tokens",
  4. "title": "Token",
  5. "description": "Tokens are required to authenticate against the API",
  6. "stability": "stable",
  7. "type": "object",
  8. "definitions": {
  9. "identity": {
  10. "description": "Email Address or other 3rd party providers identifier",
  11. "example": "[email protected]",
  12. "type": "string"
  13. },
  14. "secret": {
  15. "description": "A password or key",
  16. "example": "correct horse battery staple",
  17. "type": "string"
  18. },
  19. "token": {
  20. "description": "JWT",
  21. "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.O_frfYM8RzmRsUNigHtu0_jZ_utSejyr1axMGa8rlsk",
  22. "type": "string"
  23. },
  24. "expires": {
  25. "description": "Token expiry time",
  26. "format": "date-time",
  27. "type": "string"
  28. },
  29. "scope": {
  30. "description": "Scope of the Token, defaults to 'user'",
  31. "example": "user",
  32. "type": "string"
  33. }
  34. },
  35. "links": [
  36. {
  37. "title": "Create",
  38. "description": "Creates a new token.",
  39. "href": "/tokens",
  40. "access": "public",
  41. "method": "POST",
  42. "rel": "create",
  43. "schema": {
  44. "type": "object",
  45. "required": [
  46. "identity",
  47. "secret"
  48. ],
  49. "properties": {
  50. "identity": {
  51. "$ref": "#/definitions/identity"
  52. },
  53. "secret": {
  54. "$ref": "#/definitions/secret"
  55. },
  56. "scope": {
  57. "$ref": "#/definitions/scope"
  58. }
  59. }
  60. },
  61. "targetSchema": {
  62. "type": "object",
  63. "properties": {
  64. "token": {
  65. "$ref": "#/definitions/token"
  66. },
  67. "expires": {
  68. "$ref": "#/definitions/expires"
  69. }
  70. }
  71. }
  72. },
  73. {
  74. "title": "Refresh",
  75. "description": "Returns a new token.",
  76. "href": "/tokens",
  77. "access": "private",
  78. "method": "GET",
  79. "rel": "self",
  80. "http_header": {
  81. "$ref": "../examples.json#/definitions/auth_header"
  82. },
  83. "schema": {},
  84. "targetSchema": {
  85. "type": "object",
  86. "properties": {
  87. "token": {
  88. "$ref": "#/definitions/token"
  89. },
  90. "expires": {
  91. "$ref": "#/definitions/expires"
  92. },
  93. "scope": {
  94. "$ref": "#/definitions/scope"
  95. }
  96. }
  97. }
  98. }
  99. ]
  100. }