forked from wagnerdelima/drf-social-oauth2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.yaml
271 lines (248 loc) · 8.66 KB
/
api.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
openapi: "3.0.3"
info:
title: DRF Social Oauth2 API Definitions
version: "1.1.3"
servers:
- url: http://127.0.0.1:8000
paths:
/auth/convert-token/:
post:
summary: Creates a new authentication token.
tags:
- Tokens
requestBody:
description: Body of the convert token request.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ConvertToken'
responses:
200:
description: Valid convert token response.
$ref: '#/components/responses/ConvertToken'
400:
description: Bad request if grant_type is not passed.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error raised by request.
example: "unsupported_grant_type"
/auth/revoke-token:
post:
summary: Revokes one specific token.
tags:
- Tokens
requestBody:
description: Body of the revoke token request.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RevokeToken'
responses:
204:
description: Valid revoke token response.
content:
application/json:
schema:
type: string
example: ""
400:
description: Bad request if token is not passed.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error raised by request.
example: "invalid_request"
error_description:
type: string
description: Message raised by request.
example: "Missing token parameter"
401:
description: Unauthorized if client id and/or client secret is/are not passed.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error raised by request.
example: "invalid_client"
/auth/invalidate-sessions:
post:
summary: Delete all access tokens associated with a client id.
tags:
- Tokens
requestBody:
description: Body of the invalidate session request.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/InvalidateSessions'
responses:
204:
description: Valid invalidate sessions response.
content:
application/json:
schema:
type: string
example: ""
400:
description: Missing client_id field response.
content:
application/json:
schema:
type: object
properties:
client_id:
type: string
default: "This field is required."
/auth/disconnect-backend:
post:
summary: An endpoint for disconnect social auth backend providers, such as Facebook.
tags:
- Backends
requestBody:
description: Body of the disconnect backend request.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DisconnectBackend'
responses:
204:
description: Valid disconnect backend response.
content:
application/json:
schema:
type: string
example: ""
400:
description: Missing backend field response.
content:
application/json:
schema:
type: object
properties:
backend:
type: string
default: "This field is required."
components:
schemas:
ConvertToken:
description: The definition of a Convert Token request.
required:
- grant_type
- client_id
- client_secret
- backend
- token
properties:
grant_type:
description: The type of the token.
type: string
example: "convert_token"
client_id:
description: The client id created at Application level in the Django Admin Dashboard.
type: string
example: "4P1BfkLBGUaHZNLjgHMJOChwuFC7C22bmHVVkmo"
client_secret:
description: The client secret created at Application level in the Django Admin Dashboard.
type: string
example: "lxgUAsfHVZztbBXmD9vnssazOM7fp17BV7C3noHh5kMnHkPRLXQ8Bg9ljnANxo2PiF4jSVmJZRynlP5LDsLvt0746QfNof8suw5fdMMNeSOnSrYHM40RzgdCxFQEqtCd"
backend:
description: The backend you are authenticating against.
type: string
example: "facebook"
token:
description: |
The Access Token generated by the API of the backend. For instance, if you are authenticating with Facebook,
go to Facebook For Developers - Graph API Explorer and create an access token for you.
type: string
example: "EAAxWEZCUZCn7ABAC7Mpo3IP9s3nd2zKMkZAOQOfg5CQfBhiU2DWRZCcZCeDypH12m5GTMHZAmYSUeULnIbZBJZBQMzZC4nndgx
jQXunDfRGy1zmAxRy7fT5F8Y50CuYDZAH6Gwq5iBQdltF8C0GRZBrJXGTZBiW6ztrvqLq62NEpLEZAWZAMNW3JF6T2U7108ZBWB4
VcDYtF7AxaSlhtwZDZD"
RevokeToken:
description: The definition of a Revoke Token request.
required:
- client_id
- client_secret
- token
properties:
client_id:
description: The client id created at Application level in the Django Admin Dashboard.
type: string
example: "4P1BfkLBGUaHZNLjgHMJOChwuFC7C22bmHVVkmo"
client_secret:
description: The client secret created at Application level in the Django Admin Dashboard.
type: string
example: "lxgUAsfHVZztbBXmD9vnssazOM7fp17BV7C3noHh5kMnHkPRLXQ8Bg9ljnANxo2PiF4jSVmJZRynlP5LDsLvt0746QfNof8suw5fdMMNeSOnSrYHM40RzgdCxFQEqtCd"
token:
description: |
The token generated by a successful response to the convert-token endpoint. The token may be
JWTed or not.
type: string
example: "fQZFFAtcmDZ3iYmUfYfuRRH8PYpR7Y"
DisconnectBackend:
description: The definition of a Disconnect Backend request.
required:
- backend
- association_id
properties:
backend:
description: The backend you authenticated against.
type: string
example: "facebook"
association_id:
description: The association id you created.
type: string
example: "association id"
InvalidateSessions:
description: The definition of a Invalidate Sessions.
required:
- client_id
properties:
client_id:
description: The client id created at Application level in the Django Admin Dashboard.
type: string
example: "4P1BfkLBGUaHZNLjgHMJOChwuFC7C22bmHVVkmo"
responses:
ConvertToken:
description: Convert Token successfull response.
content:
application/json:
schema:
properties:
access_token:
description: The newly created access token.
type: string
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbiI6InFkOEpua3JpSHUydFJyMVZDemRRYzJ3dHlybTdYaiJ9.6Pu8qKJJk73vjAFg-d8HFwo6RMRBvgo1d_XirwWMdpI"
expires_in:
description: A timestamp in seconds of the validity of the access token.
type: integer
format: int64
example: 36000
token_type:
description: The type of token gererated.
type: string
example: "Bearer"
scope:
description: The permissions given to the token, read, write etc.
type: string
example: "read, write"
refresh_token:
description: |
The refresh token created by the convert-token. Refresh tokens can be used to renew an access token.
type: string
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbiI6Im1zT3R0cUhDM0JLVmVzSU5wR1hoS2p6bTJvWGZ4ZSJ9.p-5oohVV2Oeg4dsmX2g6pNiDXamR4-oaPEzK4Ki1fZQ"