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.

231 lines
8.7 KiB

  1. {
  2. "openapi": "3.0.3",
  3. "info": {
  4. "title": "oauth2",
  5. "version": "0.0.1",
  6. "description": "Allows OAuth2 compatible authentication from other web applications.",
  7. "license": {
  8. "name": "agpl"
  9. }
  10. },
  11. "components": {
  12. "securitySchemes": {
  13. "basic_auth": {
  14. "type": "http",
  15. "scheme": "basic"
  16. },
  17. "bearer_auth": {
  18. "type": "http",
  19. "scheme": "bearer"
  20. }
  21. },
  22. "schemas": {}
  23. },
  24. "paths": {
  25. "/index.php/apps/oauth2/authorize": {
  26. "get": {
  27. "operationId": "login_redirector-authorize",
  28. "summary": "Authorize the user",
  29. "tags": [
  30. "login_redirector"
  31. ],
  32. "security": [
  33. {},
  34. {
  35. "bearer_auth": []
  36. },
  37. {
  38. "basic_auth": []
  39. }
  40. ],
  41. "parameters": [
  42. {
  43. "name": "client_id",
  44. "in": "query",
  45. "description": "Client ID",
  46. "required": true,
  47. "schema": {
  48. "type": "string"
  49. }
  50. },
  51. {
  52. "name": "state",
  53. "in": "query",
  54. "description": "State of the flow",
  55. "required": true,
  56. "schema": {
  57. "type": "string"
  58. }
  59. },
  60. {
  61. "name": "response_type",
  62. "in": "query",
  63. "description": "Response type for the flow",
  64. "required": true,
  65. "schema": {
  66. "type": "string"
  67. }
  68. },
  69. {
  70. "name": "redirect_uri",
  71. "in": "query",
  72. "description": "URI to redirect to after the flow (is only used for legacy ownCloud clients)",
  73. "schema": {
  74. "type": "string",
  75. "default": ""
  76. }
  77. }
  78. ],
  79. "responses": {
  80. "200": {
  81. "description": "Client not found",
  82. "content": {
  83. "text/html": {
  84. "schema": {
  85. "type": "string"
  86. }
  87. }
  88. }
  89. },
  90. "303": {
  91. "description": "Redirect to login URL",
  92. "headers": {
  93. "Location": {
  94. "schema": {
  95. "type": "string"
  96. }
  97. }
  98. }
  99. }
  100. }
  101. }
  102. },
  103. "/index.php/apps/oauth2/api/v1/token": {
  104. "post": {
  105. "operationId": "oauth_api-get-token",
  106. "summary": "Get a token",
  107. "tags": [
  108. "oauth_api"
  109. ],
  110. "security": [
  111. {},
  112. {
  113. "bearer_auth": []
  114. },
  115. {
  116. "basic_auth": []
  117. }
  118. ],
  119. "requestBody": {
  120. "required": true,
  121. "content": {
  122. "application/json": {
  123. "schema": {
  124. "type": "object",
  125. "required": [
  126. "grant_type"
  127. ],
  128. "properties": {
  129. "grant_type": {
  130. "type": "string",
  131. "enum": [
  132. "authorization_code",
  133. "refresh_token"
  134. ],
  135. "description": "Token type that should be granted"
  136. },
  137. "code": {
  138. "type": "string",
  139. "nullable": true,
  140. "description": "Code of the flow"
  141. },
  142. "refresh_token": {
  143. "type": "string",
  144. "nullable": true,
  145. "description": "Refresh token"
  146. },
  147. "client_id": {
  148. "type": "string",
  149. "nullable": true,
  150. "description": "Client ID"
  151. },
  152. "client_secret": {
  153. "type": "string",
  154. "nullable": true,
  155. "description": "Client secret"
  156. }
  157. }
  158. }
  159. }
  160. }
  161. },
  162. "responses": {
  163. "500": {
  164. "description": "",
  165. "content": {
  166. "text/plain": {
  167. "schema": {
  168. "type": "string"
  169. }
  170. }
  171. }
  172. },
  173. "200": {
  174. "description": "Token returned",
  175. "content": {
  176. "application/json": {
  177. "schema": {
  178. "type": "object",
  179. "required": [
  180. "access_token",
  181. "token_type",
  182. "expires_in",
  183. "refresh_token",
  184. "user_id"
  185. ],
  186. "properties": {
  187. "access_token": {
  188. "type": "string"
  189. },
  190. "token_type": {
  191. "type": "string"
  192. },
  193. "expires_in": {
  194. "type": "integer",
  195. "format": "int64"
  196. },
  197. "refresh_token": {
  198. "type": "string"
  199. },
  200. "user_id": {
  201. "type": "string"
  202. }
  203. }
  204. }
  205. }
  206. }
  207. },
  208. "400": {
  209. "description": "Getting token is not possible",
  210. "content": {
  211. "application/json": {
  212. "schema": {
  213. "type": "object",
  214. "required": [
  215. "error"
  216. ],
  217. "properties": {
  218. "error": {
  219. "type": "string"
  220. }
  221. }
  222. }
  223. }
  224. }
  225. }
  226. }
  227. }
  228. }
  229. },
  230. "tags": []
  231. }