-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDJoserAuthAPI.postman_collection.json
More file actions
661 lines (661 loc) · 19.9 KB
/
DJoserAuthAPI.postman_collection.json
File metadata and controls
661 lines (661 loc) · 19.9 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
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
{
"info": {
"_postman_id": "5053cbc4-6e56-46b9-9551-07986e43b7f6",
"name": "DJoserAuthAPI",
"description": "## DJoserAuthAPI\n\nThis collection covers the authentication and user management API built with **Djoser** and **Django REST Framework**. It includes endpoints for the full user lifecycle — from registration to account deletion — as well as seller features and Google OAuth2 social login.\n\n### What's included\n\n**Authentication (JWT)**\n\n- Register a new account, activate it via email, and log in to receive JWT tokens.\n \n- Refresh access tokens and log out securely.\n \n\n**Password Management**\n\n- Change your password while logged in, or trigger a reset email and confirm the reset.\n \n\n**User Profile**\n\n- Retrieve, update, or delete your own account data.\n \n\n**Google OAuth2**\n\n- Initiate the Google OAuth2 login flow and handle the callback to authenticate via Google.\n \n\n**Seller Features** _(in the_ `_Seller_` _folder)_\n\n- Request to become a seller (triggers an email), verify a seller account, and access the seller dashboard.\n \n\n### Getting Started\n\nSet the `baseURL` collection variable to your API's base URL (e.g., `http://127.0.0.1:8000/api/v1/auth`) before running any requests. Most endpoints require a valid JWT access token — use the **Login** request first and attach the returned token as a Bearer token.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "43960170",
"_collection_link": "https://go.postman.co/collection/43960170-5053cbc4-6e56-46b9-9551-07986e43b7f6?source=collection_link"
},
"item": [
{
"name": "Seller",
"item": [
{
"name": "Become Seller(email sending)",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "",
"description": "JWT <access>",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "store_name",
"value": "",
"type": "text",
"uuid": "5d200559-3c1c-4c24-9b3e-860a5ceed425"
},
{
"key": "business_email",
"value": "",
"type": "text",
"uuid": "c5ab1308-1764-4fde-a816-12ffc2f18f8d"
}
]
},
"url": {
"raw": "{{baseURL}}/seller/",
"host": [
"{{baseURL}}"
],
"path": [
"seller",
""
]
}
},
"response": []
},
{
"name": "Verify seller",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "",
"description": "JWT <access>",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": []
},
"url": {
"raw": "{{baseURL}}/verify-seller/<token>/",
"host": [
"{{baseURL}}"
],
"path": [
"verify-seller",
"<token>",
""
]
}
},
"response": []
},
{
"name": "Seller Dashboard",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "",
"description": "JWT <access>",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": []
},
"url": {
"raw": "{{baseURL}}/sellerDashboard/",
"host": [
"{{baseURL}}"
],
"path": [
"sellerDashboard",
""
]
}
},
"response": []
}
],
"description": "## Seller\n\nThis folder contains endpoints for managing the seller onboarding flow within the DJoserAuthAPI.\n\n### Endpoints\n\n- **Become Seller** – Submits a seller registration request and triggers a verification email to the provided address.\n \n- **Verify Seller** – Confirms the seller's identity using a unique token sent via email. Complete this step to activate seller privileges.\n \n- **Seller Dashboard** – Retrieves the authenticated seller's dashboard data.\n \n\n### Authentication\n\nRequests in this folder require a valid authenticated user session. Ensure your `{{baseURL}}` environment variable is set before running these requests.\n\n### Workflow\n\n1. Call **Become Seller** with the required details to initiate the process.\n \n2. Check your email and use the verification link/token with **Verify Seller**.\n \n3. Once verified, access your **Seller Dashboard**."
},
{
"name": "Google-oauth",
"item": [
{
"name": "Google Login",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseURL}}/o/google-oauth2/?redirect_uri=http://127.0.0.1:8000/api/v1/auth/o/google-oauth2/",
"host": [
"{{baseURL}}"
],
"path": [
"o",
"google-oauth2",
""
],
"query": [
{
"key": "redirect_uri",
"value": "http://127.0.0.1:8000/api/v1/auth/o/google-oauth2/"
}
]
}
},
"response": []
},
{
"name": "Authorize Google Login",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseURL}}/o/google-oauth2/?state= &code=",
"host": [
"{{baseURL}}"
],
"path": [
"o",
"google-oauth2",
""
],
"query": [
{
"key": "state",
"value": " "
},
{
"key": "code",
"value": ""
}
]
}
},
"response": []
}
],
"description": "## Google OAuth\n\nThis folder contains endpoints for authenticating users via **Google OAuth 2.0** using the Djoser social auth integration.\n\n### Endpoints\n\n- **Initiate Google OAuth** – Redirects the user to Google's authentication page. Provide a `redirect_uri` pointing to your callback URL to begin the OAuth flow.\n \n- **Complete Google OAuth** – Handles the callback from Google after the user grants permission. Exchanges the authorization `code` and `state` for an access token to authenticate the user in the system.\n \n\n### Authentication\n\nNo prior authentication is required to initiate the flow. The `code` and `state` parameters in the callback request are provided automatically by Google after the user logs in.\n\n### Workflow\n\n1. Call the **Initiate Google OAuth** endpoint with your `redirect_uri` to get the Google login URL.\n \n2. Redirect the user to that URL so they can log in with their Google account.\n \n3. Google will redirect back to your `redirect_uri` with `code` and `state` query parameters.\n \n4. Call the **Complete Google OAuth** endpoint with those parameters to receive an authentication token.\n \n\n### Environment Setup\n\nEnsure `{{baseURL}}` is set in your active environment before running these requests."
},
{
"name": "Registration",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript",
"packages": {},
"requests": {}
}
},
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript",
"packages": {},
"requests": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "username",
"value": "",
"type": "text",
"uuid": "5d077ef6-4a35-4a68-bdb9-c23b70c7d274",
"description": "Add Unique Username"
},
{
"key": "email",
"value": "",
"type": "text",
"uuid": "8f63994a-7ea3-4091-a0f5-d54eb222d5c9",
"description": "Add Unique and verified Email ( only Gmail is approved)"
},
{
"key": "password",
"value": "",
"type": "text",
"uuid": "205bce75-bd63-4a3d-8304-ac93fedd6ce2",
"description": "Add unique and strong password(atleast 8 In length)"
},
{
"key": "re_password",
"value": "",
"type": "text",
"uuid": "2ec23331-9f24-4392-99c8-79fcf2f257b3",
"description": "Retype Same password from above"
}
]
},
"url": {
"raw": "{{baseURL}}/users/",
"host": [
"{{baseURL}}"
],
"path": [
"users",
""
]
},
"description": "Registers a new user account using the Djoser authentication framework for Django.\n\n**Method:** `POST` \n**URL:** `{{baseURL}}/users/` \n**Body Type:** `multipart/form-data`\n\n### Required Fields\n\n| Field | Description |\n|---|---|\n| `username` | The desired username for the new account |\n| `email` | The user's email address |\n| `password` | The account password |\n| `re_password` | Password confirmation (must match `password`) |\n\n### Notes\n- Both `password` and `re_password` must match for successful registration.\n- On success, the API returns the newly created user's details with a `201 Created` response.\n- Passwords must meet the configured Django password validation requirements."
},
"response": []
},
{
"name": "Account Activation",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "uid",
"value": "",
"type": "text",
"uuid": "04767fa0-9bef-4bdd-9a0d-ae5aff811b33"
},
{
"key": "token",
"value": "",
"type": "text",
"uuid": "6d294332-388f-4bc4-a9b9-b2bbc9441b3b"
}
]
},
"url": {
"raw": "{{baseURL}}/users/activation/",
"host": [
"{{baseURL}}"
],
"path": [
"users",
"activation",
""
]
}
},
"response": []
},
{
"name": "Login",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "email",
"value": "",
"type": "text",
"uuid": "081f508c-0d24-4a0a-b3fd-83c985e9e186",
"description": "email you registered"
},
{
"key": "password",
"value": "",
"type": "text",
"uuid": "901f3ee6-8fea-47c4-8eee-1ad0b184a742",
"description": "password"
}
]
},
"url": {
"raw": "{{baseURL}}/jwt/create/",
"host": [
"{{baseURL}}"
],
"path": [
"jwt",
"create",
""
]
}
},
"response": []
},
{
"name": "Logout",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "",
"description": "JWT <access>",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "refresh",
"value": "",
"type": "text",
"uuid": "1d12e4f6-672b-456f-a85c-b6f15e700420",
"description": "<refresh>"
}
]
},
"url": {
"raw": "{{baseURL}}/logout/",
"host": [
"{{baseURL}}"
],
"path": [
"logout",
""
]
},
"description": "Need Header(Authorization) and body (refresh)"
},
"response": []
},
{
"name": "New Access Token (Refresh)",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "refresh",
"value": "",
"type": "text",
"uuid": "275fde07-1e2e-4548-b9a3-b6f9054850e6",
"description": "<refresh>"
}
]
},
"url": {
"raw": "{{baseURL}}/jwt/refresh/",
"host": [
"{{baseURL}}"
],
"path": [
"jwt",
"refresh",
""
]
}
},
"response": []
},
{
"name": "User Data",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "",
"description": "JWT <access>",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": []
},
"url": {
"raw": "{{baseURL}}/users/me/",
"host": [
"{{baseURL}}"
],
"path": [
"users",
"me",
""
]
},
"description": "Need Header(Authorization)"
},
"response": []
},
{
"name": "Chanage User Data",
"request": {
"auth": {
"type": "bearer"
},
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "",
"description": "JWT <access>",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "username ",
"value": "LamsalSushank2",
"type": "text",
"uuid": "b893af02-c064-4ec4-a27e-528cdc634216"
},
{
"key": "email",
"value": "lamsal@gmail.com",
"type": "text",
"uuid": "11b25aee-4847-413f-be2d-c1e3a55df53c",
"disabled": true
}
]
},
"url": {
"raw": "{{baseURL}}/users/me/",
"host": [
"{{baseURL}}"
],
"path": [
"users",
"me",
""
]
},
"description": "Need Header(Authorization) and body(what to nchange for eg, username)"
},
"response": []
},
{
"name": "Change Password after login",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "",
"description": "JWT <access>",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "new_password",
"value": "",
"type": "text",
"uuid": "cb901238-e1e3-4760-aa08-15ad922c2a7f"
},
{
"key": "re_new_password",
"value": "",
"type": "text",
"uuid": "6e0a9c66-a7a4-4ae4-974e-b2787369b157"
},
{
"key": "current_password",
"value": "",
"type": "text",
"uuid": "064764f0-73c4-4768-b017-5c4a3b3322e7"
}
]
},
"url": {
"raw": "{{baseURL}}/users/set_password/",
"host": [
"{{baseURL}}"
],
"path": [
"users",
"set_password",
""
]
},
"description": "Need Header(Authorization) and body"
},
"response": []
},
{
"name": "Reset Password Email",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "email",
"value": "",
"type": "text",
"uuid": "215e0ad7-0f4f-4104-bb3f-692169c9514d",
"description": "email (registered) "
}
]
},
"url": {
"raw": "{{baseURL}}/users/reset_password/",
"host": [
"{{baseURL}}"
],
"path": [
"users",
"reset_password",
""
]
}
},
"response": []
},
{
"name": "Reset Password Confirmation",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "uid",
"value": "",
"type": "text",
"uuid": "e9aec57a-8e17-4bd3-90fa-ddfaab2cd5ea"
},
{
"key": "token",
"value": "",
"type": "text",
"uuid": "186a23d1-dfdb-48f7-a8c7-b469dbf53a8e"
},
{
"key": "new_password",
"value": "",
"type": "text",
"uuid": "b6e41e4a-8480-492d-9eb5-7db86d3ddf5d"
},
{
"key": "re_new_password",
"value": "",
"type": "text",
"uuid": "31650c8d-0904-4385-9a18-b95903682e7e"
}
]
},
"url": {
"raw": "{{baseURL}}/users/reset_password_confirm/",
"host": [
"{{baseURL}}"
],
"path": [
"users",
"reset_password_confirm",
""
]
}
},
"response": []
},
{
"name": "Delete Account",
"request": {
"method": "DELETE",
"header": [
{
"key": "Authorization",
"value": "",
"description": "JWT <access>",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "current_password",
"value": "",
"type": "text",
"uuid": "50a5c527-099f-44a6-8c79-31168e5617ef",
"description": "password required"
}
]
},
"url": {
"raw": "{{baseURL}}/users/me/",
"host": [
"{{baseURL}}"
],
"path": [
"users",
"me",
""
]
},
"description": "Need Header(Authorization) and body"
},
"response": []
}
],
"variable": [
{
"key": "baseURL",
"value": "",
"type": "default"
}
]
}