Skip to content

Commit 3bf84ed

Browse files
committed
Update postman
Signed-off-by: William <[email protected]>
1 parent b1a955d commit 3bf84ed

File tree

1 file changed

+115
-57
lines changed

1 file changed

+115
-57
lines changed

postman/SpeedyAuth.postman_collection.json

Lines changed: 115 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,23 @@
99
{
1010
"name": "Get User",
1111
"request": {
12+
"auth": {
13+
"type": "bearer",
14+
"bearer": [
15+
{
16+
"key": "token",
17+
"value": "{{token}}",
18+
"type": "string"
19+
}
20+
]
21+
},
1222
"method": "GET",
13-
"header": [
14-
{
15-
"key": "token",
16-
"value": "Bearer {{token}}",
17-
"type": "text"
18-
}
19-
],
23+
"header": [],
2024
"url": {
21-
"raw": "http://localhost:8080/api/user",
22-
"protocol": "http",
25+
"raw": "{{baseurl}}/api/user",
2326
"host": [
24-
"localhost"
27+
"{{baseurl}}"
2528
],
26-
"port": "8080",
2729
"path": [
2830
"api",
2931
"user"
@@ -40,20 +42,18 @@
4042
"header": [],
4143
"body": {
4244
"mode": "raw",
43-
"raw": "{\n \"refreshToken\":\"a69adff7299c749e89752b234684d76310d0e73e\"\n}\n",
45+
"raw": "{\n \"refreshToken\":{{refreshToken}}\n}\n",
4446
"options": {
4547
"raw": {
4648
"language": "json"
4749
}
4850
}
4951
},
5052
"url": {
51-
"raw": "http://localhost:8080/api/auth/token/refresh",
52-
"protocol": "http",
53+
"raw": "{{baseurl}}/api/auth/token/refresh",
5354
"host": [
54-
"localhost"
55+
"{{baseurl}}"
5556
],
56-
"port": "8080",
5757
"path": [
5858
"api",
5959
"auth",
@@ -80,12 +80,10 @@
8080
}
8181
},
8282
"url": {
83-
"raw": "http://localhost:8080/api/auth/register",
84-
"protocol": "http",
83+
"raw": "{{baseurl}}/api/auth/register",
8584
"host": [
86-
"localhost"
85+
"{{baseurl}}"
8786
],
88-
"port": "8080",
8987
"path": [
9088
"api",
9189
"auth",
@@ -110,27 +108,58 @@
110108
],
111109
"type": "text/javascript"
112110
}
111+
},
112+
{
113+
"listen": "prerequest",
114+
"script": {
115+
"exec": [
116+
"const baseurl = pm.environment.get('baseurl');",
117+
"const tokenUrl = baseurl + '/api/auth/login';",
118+
"var body = {",
119+
" username : \"john.doe\",",
120+
" password : \"password_2022W\"",
121+
"};",
122+
"",
123+
"const getTokenRequest = {",
124+
" method: 'POST',",
125+
" url: tokenUrl,",
126+
" mode: 'raw',",
127+
" body: {",
128+
" mode: 'raw',",
129+
" raw: JSON.stringify(body)",
130+
" }",
131+
"};",
132+
"",
133+
"pm.sendRequest(getTokenRequest, (err, response) => {",
134+
" const jsonResponse = response.json();",
135+
" console.log(jsonResponse);",
136+
" const newAccessToken = jsonResponse.token;",
137+
" console.log(newAccessToken);",
138+
"",
139+
" pm.variables.set('token', newAccessToken);",
140+
"});"
141+
],
142+
"type": "text/javascript"
143+
}
113144
}
114145
],
115146
"request": {
116147
"method": "POST",
117148
"header": [],
118149
"body": {
119150
"mode": "raw",
120-
"raw": "{\n \"authType\":\"USER_PASS\",\n \"username\":\"john.doe\",\n \"password\":\"\"\n}\n",
151+
"raw": "{\n \"username\":\"john.doe\",\n \"password\":\"password_2022W\"\n}",
121152
"options": {
122153
"raw": {
123154
"language": "json"
124155
}
125156
}
126157
},
127158
"url": {
128-
"raw": "http://localhost:8080/api/auth/login",
129-
"protocol": "http",
159+
"raw": "{{baseurl}}/api/auth/login",
130160
"host": [
131-
"localhost"
161+
"{{baseurl}}"
132162
],
133-
"port": "8080",
134163
"path": [
135164
"api",
136165
"auth",
@@ -144,30 +173,39 @@
144173
{
145174
"name": "Update User",
146175
"request": {
176+
"auth": {
177+
"type": "bearer",
178+
"bearer": [
179+
{
180+
"key": "token",
181+
"value": "{{token}}",
182+
"type": "string"
183+
}
184+
]
185+
},
147186
"method": "POST",
148187
"header": [
149188
{
150189
"key": "Authorization",
151-
"value": "Bearer {{token}}",
152-
"type": "text"
190+
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjEsInJvbGVzIjpbIlVTRVIiXSwiZXhwIjoxNzAyNjIwNDk0fQ.nFMZCSdxW54uPYHVm3XRohJ6oyisRS0nbB-gbBN61LE",
191+
"type": "text",
192+
"disabled": true
153193
}
154194
],
155195
"body": {
156196
"mode": "raw",
157-
"raw": "{\n \"firstName\":\"James\",\n \"lastName\":\"Opoku\",\n}",
197+
"raw": "{\n \"firstName\":\"William\"\n\n}",
158198
"options": {
159199
"raw": {
160200
"language": "json"
161201
}
162202
}
163203
},
164204
"url": {
165-
"raw": "http://localhost:8080/api/user/update",
166-
"protocol": "http",
205+
"raw": "{{baseurl}}/api/user/update",
167206
"host": [
168-
"localhost"
207+
"{{baseurl}}"
169208
],
170-
"port": "8080",
171209
"path": [
172210
"api",
173211
"user",
@@ -181,12 +219,23 @@
181219
{
182220
"name": "EnableTwoFactor",
183221
"request": {
222+
"auth": {
223+
"type": "bearer",
224+
"bearer": [
225+
{
226+
"key": "token",
227+
"value": "{{token}}",
228+
"type": "string"
229+
}
230+
]
231+
},
184232
"method": "POST",
185233
"header": [
186234
{
187235
"key": "Authorization",
188236
"value": "Bearer {{token}}",
189-
"type": "text"
237+
"type": "text",
238+
"disabled": true
190239
}
191240
],
192241
"body": {
@@ -199,12 +248,10 @@
199248
}
200249
},
201250
"url": {
202-
"raw": "http://localhost:8080/api/user/twofactor/enable",
203-
"protocol": "http",
251+
"raw": "{{baseurl}}/api/user/twofactor/enable",
204252
"host": [
205-
"localhost"
253+
"{{baseurl}}"
206254
],
207-
"port": "8080",
208255
"path": [
209256
"api",
210257
"user",
@@ -231,12 +278,10 @@
231278
}
232279
},
233280
"url": {
234-
"raw": "http://localhost:8080/api/auth/password/reset/request",
235-
"protocol": "http",
281+
"raw": "{{baseurl}}/api/auth/password/reset/request",
236282
"host": [
237-
"localhost"
283+
"{{baseurl}}"
238284
],
239-
"port": "8080",
240285
"path": [
241286
"api",
242287
"auth",
@@ -251,6 +296,17 @@
251296
},
252297
{
253298
"name": "Verify Two Factor",
299+
"event": [
300+
{
301+
"listen": "prerequest",
302+
"script": {
303+
"exec": [
304+
""
305+
],
306+
"type": "text/javascript"
307+
}
308+
}
309+
],
254310
"request": {
255311
"method": "POST",
256312
"header": [],
@@ -264,12 +320,10 @@
264320
}
265321
},
266322
"url": {
267-
"raw": "http://localhost:8080/api/auth/twofactor/verify",
268-
"protocol": "http",
323+
"raw": "{{baseurl}}/api/auth/twofactor/verify",
269324
"host": [
270-
"localhost"
325+
"{{baseurl}}"
271326
],
272-
"port": "8080",
273327
"path": [
274328
"api",
275329
"auth",
@@ -284,6 +338,16 @@
284338
{
285339
"name": "VerifyTOTP",
286340
"request": {
341+
"auth": {
342+
"type": "bearer",
343+
"bearer": [
344+
{
345+
"key": "token",
346+
"value": "{{token}}",
347+
"type": "string"
348+
}
349+
]
350+
},
287351
"method": "POST",
288352
"header": [],
289353
"body": {
@@ -296,12 +360,10 @@
296360
}
297361
},
298362
"url": {
299-
"raw": "http://localhost:8080/api/user/totpcode/verify",
300-
"protocol": "http",
363+
"raw": "{{baseurl}}/api/user/totpcode/verify",
301364
"host": [
302-
"localhost"
365+
"{{baseurl}}"
303366
],
304-
"port": "8080",
305367
"path": [
306368
"api",
307369
"user",
@@ -328,12 +390,10 @@
328390
}
329391
},
330392
"url": {
331-
"raw": "http://localhost:8080/api/auth/passwordless/login",
332-
"protocol": "http",
393+
"raw": "{{baseurl}}/api/auth/passwordless/login",
333394
"host": [
334-
"localhost"
395+
"{{baseurl}}"
335396
],
336-
"port": "8080",
337397
"path": [
338398
"api",
339399
"auth",
@@ -359,12 +419,10 @@
359419
}
360420
},
361421
"url": {
362-
"raw": "http://localhost:8080/api/auth/passwordless/complete",
363-
"protocol": "http",
422+
"raw": "{{baseurl}}/api/auth/passwordless/complete",
364423
"host": [
365-
"localhost"
424+
"{{baseurl}}"
366425
],
367-
"port": "8080",
368426
"path": [
369427
"api",
370428
"auth",

0 commit comments

Comments
 (0)