-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathOAuthAuthCode.json
More file actions
450 lines (449 loc) · 14.4 KB
/
OAuthAuthCode.json
File metadata and controls
450 lines (449 loc) · 14.4 KB
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
{
"openapi": "3.0.3",
"info": {
"title": "OAuth",
"version": ""
},
"servers": [
{
"url": "https://wwwcie.ups.com/",
"description": "Customer Integration Environment"
},
{
"url": "https://onlinetools.ups.com/",
"description": "Production"
}
],
"tags": [
{
"name": "OAuthAuthCode_other",
"x-displayName": "Methods",
"description": "Retrieve OAuth Bearer token on behalf of another user. <br /><a href=\"https://developer.ups.com/api/reference/oauth/authorization-code\" target=\"_blank\">Authorization Code</a><br /><a href=\"https://github.com/UPS-API\" target=\"_blank\">GitHub - view sample integration code</a>"
}
],
"paths": {
"/security/v1/oauth/authorize": {
"get": {
"summary": "Authorize Client",
"description": "The Authorize Client endpoint initiates the OAuth flow by redirecting the user to UPS to log in and authorize the client application. It accepts the parameters listed below to facilitate the user authorization flow. A successful response redirects back to the client with an authorization code that can be exchanged for an access token.",
"operationId": "AuthorizeClient",
"parameters": [
{
"in": "query",
"name": "client_id",
"schema": {
"type": "string"
},
"description": "Client id for the requesting application.",
"required": true
},
{
"in": "query",
"name": "redirect_uri",
"schema": {
"type": "string"
},
"description": "Callback URL for the requesting application.",
"required": true
},
{
"in": "query",
"name": "response_type",
"schema": {
"type": "string"
},
"description": "Valid Values: code",
"required": true
},
{
"in": "query",
"name": "state",
"schema": {
"type": "string"
},
"description": "Optional value supplied by the client, will be returned during the redirection back to the client. Can be utilized to maintain state between Auth-Code request and callback event.",
"required": false
},
{
"in": "query",
"name": "scope",
"schema": {
"type": "string"
},
"description": "Optional value supplied by the client, will be returned during the redirection back to the client.",
"required": false
}
],
"responses": {
"302": {
"description": "successful operation",
"headers": {
"location": {
"description": "The UPS login redirection URI. Will be in the following format: https://www.ups.com/lasso/signin?client_id={client_id}&redirect_uri={redirect_uri}&response_type=code&scope={scope}&state={state}&type=ups_com_api",
"schema": {
"type": "string"
}
},
"appname": {
"description": "App name of the application requesting the Auth-Code.",
"schema": {
"type": "string"
}
},
"displayname": {
"description": "Display name of the application requesting the Auth-Code.",
"schema": {
"type": "string"
}
}
}
},
"400": {
"description": "Invalid Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tokenErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tokenErrorResponse"
}
}
}
}
}
}
},
"/security/v1/oauth/token": {
"post": {
"security": [
{
"basicAuth": []
}
],
"description": "The Generate Token endpoint exchanges the authorization code received from Authorize Client for an access token and a refresh token. The client uses the access token to make API requests on behalf of the user by including it in the Authorization header. The access token will expire after a certain period and can be refreshed by using the RefreshToken endpoint.",
"operationId": "GenerateToken",
"parameters": [
{
"in": "header",
"name": "x-merchant-id",
"schema": {
"type": "string"
},
"description": "Client merchant ID",
"required": false
}
],
"requestBody": {
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"type": "object",
"properties": {
"grant_type": {
"type": "string",
"description": "Valid values: authorization_code",
"default": "authorization_code"
},
"code": {
"type": "string",
"description": "Authorization code from the UPS login system."
},
"redirect_uri": {
"type": "string",
"description": "Callback URL for the requesting application."
}
},
"required": [ "grant_type", "code", "redirect_uri" ]
}
}
}
},
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/generateTokenSuccessResponse"
}
}
}
},
"400": {
"description": "Invalid Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tokenErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tokenErrorResponse"
}
}
}
},
"403": {
"description": "Blocked Merchant",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tokenErrorResponse"
}
}
}
},
"429": {
"description": "Quota Limit Exceeded",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tokenErrorResponse"
}
}
}
}
}
}
},
"/security/v1/oauth/refresh": {
"post": {
"security": [
{
"basicAuth": []
}
],
"summary": "Refresh Token",
"operationId": "RefreshToken",
"description": "The RefreshToken endpoint is used to refresh an expired access token in order to continue accessing the UPS API on behalf of a user. The endpoint generates a new access/refresh token pair by exchanging a valid refresh token. A successful response returns new access and refresh tokens for ongoing API access without reprompting the user.",
"parameters": [],
"requestBody": {
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"type": "object",
"properties": {
"grant_type": {
"type": "string",
"description": "Valid values: refresh_token",
"default": "refresh_token"
},
"refresh_token": {
"type": "string",
"description": "Refresh token from GenerateToken operation"
}
},
"required": [ "grant_type", "refresh_token" ]
}
}
}
},
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/refreshTokenSuccessResponse"
}
}
}
},
"400": {
"description": "Invalid Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tokenErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tokenErrorResponse"
}
}
}
},
"429": {
"description": "Quota Limit Exceeded",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tokenErrorResponse"
}
}
}
}
}
}
}
},
"components": {
"securitySchemes": {
"basicAuth": {
"type": "http",
"scheme": "basic",
"description": "Find your Client ID and Secret on your app info page. <br/> 1. Select \\\"Try It\\\" <br/> 2. In the Security section enter your Client ID as the Username and your Secret as the Password.<br/> 3. Enter any additional information in the Body and Parameters sections.<br/> 4. Select \\\"Send\\\" to execute your API request"
}
},
"schemas": {
"generateTokenSuccessResponse": {
"type": "object",
"properties": {
"refresh_token_expires_in": {
"description": "Expiration time for requested refresh token in seconds.",
"type": "string"
},
"refresh_token_status": {
"description": "Status for requested refresh token.",
"type": "string"
},
"token_type": {
"description": "Type of requested access token",
"type": "string"
},
"issued_at": {
"description": "Issue time of requested token.",
"type": "string"
},
"client_id": {
"description": "Client id for requested token.",
"type": "string"
},
"access_token": {
"description": "Token to be used in API requests.",
"type": "string"
},
"refresh_token": {
"description": "Refresh token to be used in refresh requests when obtaining new access token.",
"type": "string"
},
"scope": {
"description": "Scope for requested token.",
"type": "string"
},
"refresh_token_issued_at": {
"description": "Time that refresh token was issued.",
"type": "string"
},
"expires_in": {
"description": "Expire time for requested token in seconds.",
"type": "string"
},
"refresh_count": {
"description": "Number of refreshes for requested token.",
"type": "string"
},
"status": {
"description": "Status for requested token.",
"type": "string"
}
}
},
"refreshTokenSuccessResponse": {
"type": "object",
"properties": {
"refresh_token_expires_in": {
"description": "Expiration time for requested refresh token in seconds.",
"type": "string"
},
"refresh_token_status": {
"description": "Status for requested refresh token.",
"type": "string"
},
"token_type": {
"description": "Type for requested token.",
"type": "string"
},
"issued_at": {
"description": "Issue time for requested token.",
"type": "string"
},
"client_id": {
"description": "Client id for requested token.",
"type": "string"
},
"access_token": {
"description": "Token to be used in API requests.",
"type": "string"
},
"refresh_token": {
"description": "Token to be used in refresh requests.",
"type": "string"
},
"scope": {
"description": "Scope for requested token.",
"type": "string"
},
"refresh_token_issued_at": {
"description": "Issue time for requested refresh token.",
"type": "string"
},
"expires_in": {
"description": "Expiration time for requested access token in seconds.",
"type": "string"
},
"refresh_count": {
"description": "Number of refreshes for requested token.",
"type": "string"
},
"status": {
"description": "Status for requested token.",
"type": "string"
}
}
},
"tokenErrorResponse": {
"type": "object",
"properties": {
"response": {
"$ref": "#/components/schemas/errorResponseWrapper"
}
}
},
"errorResponseWrapper": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"$ref": "#/components/schemas/errors"
}
}
}
},
"errors": {
"type": "object",
"properties": {
"code": {
"description": "Error code",
"type": "string"
},
"message": {
"description": "Error message",
"type": "string"
}
}
}
}
}
}