@djangocfg/api 2.1.482 → 2.1.484

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/dist/auth.cjs +79 -25
  3. package/dist/auth.cjs.map +1 -1
  4. package/dist/auth.d.cts +14 -1
  5. package/dist/auth.d.ts +14 -1
  6. package/dist/auth.mjs +79 -25
  7. package/dist/auth.mjs.map +1 -1
  8. package/dist/clients.cjs +29 -8
  9. package/dist/clients.cjs.map +1 -1
  10. package/dist/clients.d.cts +22 -2
  11. package/dist/clients.d.ts +22 -2
  12. package/dist/clients.mjs +29 -8
  13. package/dist/clients.mjs.map +1 -1
  14. package/dist/hooks.cjs +29 -8
  15. package/dist/hooks.cjs.map +1 -1
  16. package/dist/hooks.mjs +29 -8
  17. package/dist/hooks.mjs.map +1 -1
  18. package/dist/index.cjs +31 -9
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +32 -4
  21. package/dist/index.d.ts +32 -4
  22. package/dist/index.mjs +31 -9
  23. package/dist/index.mjs.map +1 -1
  24. package/package.json +2 -2
  25. package/src/_api/generated/_cfg_accounts/api.ts +3 -3
  26. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpConsentPolicyRetrieve.ts +2 -2
  27. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts +2 -2
  28. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts +2 -2
  29. package/src/_api/generated/_cfg_accounts/index.ts +1 -1
  30. package/src/_api/generated/_cfg_accounts/openapi.json +21 -43
  31. package/src/_api/generated/_cfg_accounts/schemas/OAuthCallbackRequestRequest.ts +1 -0
  32. package/src/_api/generated/_cfg_accounts/schemas/OAuthTokenResponse.ts +1 -0
  33. package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyRequest.ts +1 -0
  34. package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts +1 -0
  35. package/src/_api/generated/_cfg_totp/openapi.json +5 -0
  36. package/src/_api/generated/_cfg_totp/schemas/VerifyResponse.ts +1 -0
  37. package/src/_api/generated/helpers/auth.ts +27 -6
  38. package/src/_api/generated/index.ts +1 -1
  39. package/src/_api/generated/openapi.json +26 -43
  40. package/src/_api/generated/sdk.gen.ts +1 -1
  41. package/src/_api/generated/types.gen.ts +28 -0
  42. package/src/auth/context/AccountsContext.tsx +29 -0
  43. package/src/auth/context/AuthContext.tsx +3 -2
  44. package/src/auth/context/types.ts +1 -1
  45. package/src/auth/hooks/useAuthForm.ts +3 -2
  46. package/src/auth/hooks/useAuthFormState.ts +3 -0
  47. package/src/auth/hooks/useAuthRedirect.ts +2 -2
  48. package/src/auth/hooks/useGithubAuth.ts +34 -21
  49. package/src/auth/hooks/useTwoFactorVerify.ts +5 -3
  50. package/src/auth/types/form.ts +3 -1
  51. package/src/index.ts +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/api",
3
- "version": "2.1.482",
3
+ "version": "2.1.484",
4
4
  "description": "Auto-generated TypeScript API client with React hooks, SWR integration, and Zod validation for Django REST Framework backends",
5
5
  "keywords": [
6
6
  "django",
@@ -84,7 +84,7 @@
84
84
  "zod": "^4.3.6"
85
85
  },
86
86
  "devDependencies": {
87
- "@djangocfg/typescript-config": "^2.1.482",
87
+ "@djangocfg/typescript-config": "^2.1.484",
88
88
  "@testing-library/react": "^16.3.2",
89
89
  "@types/node": "^25.9.5",
90
90
  "@types/react": "19.2.15",
@@ -8,7 +8,7 @@ import { APILogger, type LoggerConfig } from '../helpers/logger';
8
8
 
9
9
  import { CfgAccountsApiKey } from '../sdk.gen';
10
10
  import { CfgAccountsOauth } from '../sdk.gen';
11
- import { CfgAccounts } from '../sdk.gen';
11
+ import { CfgAccountsOtp } from '../sdk.gen';
12
12
  import { CfgAccountsProfile } from '../sdk.gen';
13
13
  import { CfgAccountsAuth } from '../sdk.gen';
14
14
 
@@ -40,7 +40,7 @@ export class API {
40
40
 
41
41
  readonly cfgAccountsApiKey = CfgAccountsApiKey;
42
42
  readonly cfgAccountsOauth = CfgAccountsOauth;
43
- readonly cfgAccounts = CfgAccounts;
43
+ readonly cfgAccountsOtp = CfgAccountsOtp;
44
44
  readonly cfgAccountsProfile = CfgAccountsProfile;
45
45
  readonly cfgAccountsAuth = CfgAccountsAuth;
46
46
 
@@ -91,5 +91,5 @@ export class API {
91
91
  }
92
92
  }
93
93
 
94
- export { CfgAccountsApiKey, CfgAccountsOauth, CfgAccounts, CfgAccountsProfile, CfgAccountsAuth };
94
+ export { CfgAccountsApiKey, CfgAccountsOauth, CfgAccountsOtp, CfgAccountsProfile, CfgAccountsAuth };
95
95
  export { auth };
@@ -6,7 +6,7 @@
6
6
 
7
7
  import useSWR from "swr";
8
8
  import type { SWRConfiguration } from "swr";
9
- import { CfgAccounts } from "../../sdk.gen";
9
+ import { CfgAccountsOtp } from "../../sdk.gen";
10
10
  import type { CfgAccountsOtpConsentPolicyRetrieveData, CfgAccountsOtpConsentPolicyRetrieveResponses } from "../../types.gen";
11
11
  import { ConsentPolicySchema } from "../schemas/ConsentPolicy";
12
12
 
@@ -29,7 +29,7 @@ export function useCfgAccountsOtpConsentPolicyRetrieve(
29
29
  return useSWR<Result>(
30
30
  key,
31
31
  async () => {
32
- const res = await CfgAccounts.cfgAccountsOtpConsentPolicyRetrieve({ ...(args ?? {}), throwOnError: true } as never);
32
+ const res = await CfgAccountsOtp.cfgAccountsOtpConsentPolicyRetrieve({ ...(args ?? {}), throwOnError: true } as never);
33
33
  const data = res.data as Result;
34
34
  const parsed = ConsentPolicySchema.safeParse(data);
35
35
  if (!parsed.success) {
@@ -6,7 +6,7 @@
6
6
 
7
7
  import useSWRMutation from "swr/mutation";
8
8
  import type { SWRMutationConfiguration } from "swr/mutation";
9
- import { CfgAccounts } from "../../sdk.gen";
9
+ import { CfgAccountsOtp } from "../../sdk.gen";
10
10
  import type { CfgAccountsOtpRequestCreateData, CfgAccountsOtpRequestCreateResponses } from "../../types.gen";
11
11
  import { OTPRequestResponseSchema } from "../schemas/OTPRequestResponse";
12
12
 
@@ -19,7 +19,7 @@ export function useCfgAccountsOtpRequestCreate(
19
19
  return useSWRMutation<Result, Error, readonly ["cfg_accounts_otp_request_create"], Args>(
20
20
  ["cfg_accounts_otp_request_create"] as const,
21
21
  async (_key, { arg }: { arg: Args }) => {
22
- const res = await CfgAccounts.cfgAccountsOtpRequestCreate({ ...arg, throwOnError: true } as never);
22
+ const res = await CfgAccountsOtp.cfgAccountsOtpRequestCreate({ ...arg, throwOnError: true } as never);
23
23
  const data = res.data as Result;
24
24
  const parsed = OTPRequestResponseSchema.safeParse(data);
25
25
  if (!parsed.success) {
@@ -6,7 +6,7 @@
6
6
 
7
7
  import useSWRMutation from "swr/mutation";
8
8
  import type { SWRMutationConfiguration } from "swr/mutation";
9
- import { CfgAccounts } from "../../sdk.gen";
9
+ import { CfgAccountsOtp } from "../../sdk.gen";
10
10
  import type { CfgAccountsOtpVerifyCreateData, CfgAccountsOtpVerifyCreateResponses } from "../../types.gen";
11
11
  import { OTPVerifyResponseSchema } from "../schemas/OTPVerifyResponse";
12
12
 
@@ -19,7 +19,7 @@ export function useCfgAccountsOtpVerifyCreate(
19
19
  return useSWRMutation<Result, Error, readonly ["cfg_accounts_otp_verify_create"], Args>(
20
20
  ["cfg_accounts_otp_verify_create"] as const,
21
21
  async (_key, { arg }: { arg: Args }) => {
22
- const res = await CfgAccounts.cfgAccountsOtpVerifyCreate({ ...arg, throwOnError: true } as never);
22
+ const res = await CfgAccountsOtp.cfgAccountsOtpVerifyCreate({ ...arg, throwOnError: true } as never);
23
23
  const data = res.data as Result;
24
24
  const parsed = OTPVerifyResponseSchema.safeParse(data);
25
25
  if (!parsed.success) {
@@ -2,7 +2,7 @@
2
2
  // Group barrel. DO NOT EDIT — re-run `make gen`.
3
3
 
4
4
  // Wrapper class + per-group SDK re-exports + global auth.
5
- export { API, type APIOptions, auth, CfgAccountsApiKey, CfgAccountsOauth, CfgAccounts, CfgAccountsProfile, CfgAccountsAuth } from './api';
5
+ export { API, type APIOptions, auth, CfgAccountsApiKey, CfgAccountsOauth, CfgAccountsOtp, CfgAccountsProfile, CfgAccountsAuth } from './api';
6
6
 
7
7
  // Shared utilities.
8
8
  export {
@@ -455,7 +455,7 @@
455
455
  "operationId": "cfg_accounts_otp_consent_policy_retrieve",
456
456
  "description": "Marketing-consent checkbox policy for the caller's jurisdiction.\n\nDerived from the edge-provided CF-IPCountry — the same signal stored\nas consent evidence at request time. Unknown country fails safe to\n\"unchecked\".",
457
457
  "tags": [
458
- "cfg_accounts"
458
+ "cfg_accounts_otp"
459
459
  ],
460
460
  "security": [
461
461
  {
@@ -489,7 +489,7 @@
489
489
  "operationId": "cfg_accounts_otp_request_create",
490
490
  "description": "Request OTP code to email.",
491
491
  "tags": [
492
- "cfg_accounts"
492
+ "cfg_accounts_otp"
493
493
  ],
494
494
  "requestBody": {
495
495
  "content": {
@@ -563,7 +563,7 @@
563
563
  "operationId": "cfg_accounts_otp_verify_create",
564
564
  "description": "Verify OTP code and return JWT tokens or 2FA session.\n\nIf user has 2FA enabled:\n- Returns requires_2fa=True with session_id\n- Client must complete 2FA verification at /cfg/totp/verify/\n\nIf user has no 2FA:\n- Returns JWT tokens and user data directly",
565
565
  "tags": [
566
- "cfg_accounts"
566
+ "cfg_accounts_otp"
567
567
  ],
568
568
  "requestBody": {
569
569
  "content": {
@@ -813,16 +813,6 @@
813
813
  "summary": "Profile Update with Avatar"
814
814
  }
815
815
  }
816
- },
817
- "multipart/form-data": {
818
- "schema": {
819
- "$ref": "#/components/schemas/CfgUserUpdateRequest"
820
- }
821
- },
822
- "application/x-www-form-urlencoded": {
823
- "schema": {
824
- "$ref": "#/components/schemas/CfgUserUpdateRequest"
825
- }
826
816
  }
827
817
  }
828
818
  },
@@ -893,16 +883,6 @@
893
883
  "summary": "Profile Update with Avatar"
894
884
  }
895
885
  }
896
- },
897
- "multipart/form-data": {
898
- "schema": {
899
- "$ref": "#/components/schemas/PatchedCfgUserUpdateRequest"
900
- }
901
- },
902
- "application/x-www-form-urlencoded": {
903
- "schema": {
904
- "$ref": "#/components/schemas/PatchedCfgUserUpdateRequest"
905
- }
906
886
  }
907
887
  }
908
888
  },
@@ -975,16 +955,6 @@
975
955
  "summary": "Valid Profile Update"
976
956
  }
977
957
  }
978
- },
979
- "multipart/form-data": {
980
- "schema": {
981
- "$ref": "#/components/schemas/CfgUserUpdateRequest"
982
- }
983
- },
984
- "application/x-www-form-urlencoded": {
985
- "schema": {
986
- "$ref": "#/components/schemas/CfgUserUpdateRequest"
987
- }
988
958
  }
989
959
  }
990
960
  },
@@ -1055,16 +1025,6 @@
1055
1025
  "summary": "Valid Profile Update"
1056
1026
  }
1057
1027
  }
1058
- },
1059
- "multipart/form-data": {
1060
- "schema": {
1061
- "$ref": "#/components/schemas/PatchedCfgUserUpdateRequest"
1062
- }
1063
- },
1064
- "application/x-www-form-urlencoded": {
1065
- "schema": {
1066
- "$ref": "#/components/schemas/PatchedCfgUserUpdateRequest"
1067
- }
1068
1028
  }
1069
1029
  }
1070
1030
  },
@@ -1481,6 +1441,11 @@
1481
1441
  "type": "string",
1482
1442
  "format": "uri",
1483
1443
  "description": "Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path"
1444
+ },
1445
+ "remember_me": {
1446
+ "type": "boolean",
1447
+ "default": false,
1448
+ "description": "Keep this browser signed in for 30 days"
1484
1449
  }
1485
1450
  },
1486
1451
  "required": [
@@ -1660,6 +1625,10 @@
1660
1625
  "should_prompt_2fa": {
1661
1626
  "type": "boolean",
1662
1627
  "description": "True if user should be prompted to enable 2FA"
1628
+ },
1629
+ "persistent_session": {
1630
+ "type": "boolean",
1631
+ "description": "Whether this login should persist across browser restarts"
1663
1632
  }
1664
1633
  }
1665
1634
  },
@@ -1763,6 +1732,11 @@
1763
1732
  "type": "string",
1764
1733
  "format": "uri",
1765
1734
  "description": "Source URL for tracking login (e.g., https://my.djangocfg.com)"
1735
+ },
1736
+ "remember_me": {
1737
+ "type": "boolean",
1738
+ "default": false,
1739
+ "description": "Keep this browser signed in for 30 days"
1766
1740
  }
1767
1741
  },
1768
1742
  "required": [
@@ -1815,6 +1789,10 @@
1815
1789
  "should_prompt_2fa": {
1816
1790
  "type": "boolean",
1817
1791
  "description": "Whether user should be prompted to enable 2FA"
1792
+ },
1793
+ "persistent_session": {
1794
+ "type": "boolean",
1795
+ "description": "Whether this login should persist across browser restarts"
1818
1796
  }
1819
1797
  }
1820
1798
  },
@@ -8,6 +8,7 @@ export const OAuthCallbackRequestRequestSchema = z.object({
8
8
  code: z.string().min(10).max(500),
9
9
  state: z.string().min(20).max(100),
10
10
  redirect_uri: z.string().optional(),
11
+ remember_me: z.boolean().default(false).optional(),
11
12
  });
12
13
 
13
14
  export type OAuthCallbackRequestRequest = z.infer<typeof OAuthCallbackRequestRequestSchema>;
@@ -13,6 +13,7 @@ export const OAuthTokenResponseSchema = z.object({
13
13
  is_new_user: z.boolean().default(false).optional(),
14
14
  is_new_connection: z.boolean().default(false).optional(),
15
15
  should_prompt_2fa: z.boolean().optional(),
16
+ persistent_session: z.boolean().optional(),
16
17
  });
17
18
 
18
19
  export type OAuthTokenResponse = z.infer<typeof OAuthTokenResponseSchema>;
@@ -8,6 +8,7 @@ export const OTPVerifyRequestSchema = z.object({
8
8
  identifier: z.string().min(1),
9
9
  otp: z.string().min(4).max(4),
10
10
  source_url: z.string().optional(),
11
+ remember_me: z.boolean().default(false).optional(),
11
12
  });
12
13
 
13
14
  export type OTPVerifyRequest = z.infer<typeof OTPVerifyRequestSchema>;
@@ -12,6 +12,7 @@ export const OTPVerifyResponseSchema = z.object({
12
12
  access: z.string().nullable().optional(),
13
13
  user: UserSchema.nullable().optional(),
14
14
  should_prompt_2fa: z.boolean().optional(),
15
+ persistent_session: z.boolean().optional(),
15
16
  });
16
17
 
17
18
  export type OTPVerifyResponse = z.infer<typeof OTPVerifyResponseSchema>;
@@ -902,6 +902,10 @@
902
902
  ],
903
903
  "description": "User profile data"
904
904
  },
905
+ "persistent_session": {
906
+ "type": "boolean",
907
+ "description": "Whether this login should persist across browser restarts"
908
+ },
905
909
  "remaining_backup_codes": {
906
910
  "type": "integer",
907
911
  "description": "Number of remaining backup codes (if backup code was used)"
@@ -914,6 +918,7 @@
914
918
  "required": [
915
919
  "access_token",
916
920
  "message",
921
+ "persistent_session",
917
922
  "refresh_token",
918
923
  "user"
919
924
  ]
@@ -10,6 +10,7 @@ export const VerifyResponseSchema = z.object({
10
10
  access_token: z.string(),
11
11
  refresh_token: z.string(),
12
12
  user: TotpVerifyUserSchema,
13
+ persistent_session: z.boolean(),
13
14
  remaining_backup_codes: z.number().int().optional(),
14
15
  warning: z.string().optional(),
15
16
  });
@@ -12,7 +12,7 @@ const API_KEY_KEY = 'cfg.api_key';
12
12
 
13
13
  const isBrowser = typeof window !== 'undefined';
14
14
 
15
- export type StorageMode = 'localStorage' | 'cookie';
15
+ export type StorageMode = 'localStorage' | 'sessionStorage' | 'cookie';
16
16
 
17
17
  // ── Storage backends (browser-only; server-side reads return null) ─────────
18
18
 
@@ -35,6 +35,20 @@ const localStorageBackend: KVStore = {
35
35
  },
36
36
  };
37
37
 
38
+ const sessionStorageBackend: KVStore = {
39
+ get(key) {
40
+ if (!isBrowser) return null;
41
+ try { return window.sessionStorage.getItem(key); } catch { return null; }
42
+ },
43
+ set(key, value) {
44
+ if (!isBrowser) return;
45
+ try {
46
+ if (value === null) window.sessionStorage.removeItem(key);
47
+ else window.sessionStorage.setItem(key, value);
48
+ } catch {}
49
+ },
50
+ };
51
+
38
52
  /** 30 days, matches typical refresh-token lifetime. */
39
53
  const COOKIE_MAX_AGE = 60 * 60 * 24 * 30;
40
54
 
@@ -44,7 +58,8 @@ const cookieBackend: KVStore = {
44
58
  try {
45
59
  const re = new RegExp(`(?:^|;\\s*)${encodeURIComponent(key)}=([^;]*)`);
46
60
  const m = document.cookie.match(re);
47
- return m ? decodeURIComponent(m[1]) : null;
61
+ const value = m?.[1];
62
+ return value === undefined ? null : decodeURIComponent(value);
48
63
  } catch { return null; }
49
64
  },
50
65
  set(key, value) {
@@ -70,7 +85,8 @@ function detectLocale(): string | null {
70
85
  try {
71
86
  if (typeof document !== 'undefined') {
72
87
  const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
73
- if (m) return decodeURIComponent(m[1]);
88
+ const locale = m?.[1];
89
+ if (locale !== undefined) return decodeURIComponent(locale);
74
90
  }
75
91
  if (typeof navigator !== 'undefined' && navigator.language) {
76
92
  return navigator.language;
@@ -310,7 +326,11 @@ export const auth = {
310
326
  getStorageMode(): StorageMode { return _storageMode; },
311
327
  setStorageMode(mode: StorageMode): void {
312
328
  _storageMode = mode;
313
- _storage = mode === 'cookie' ? cookieBackend : localStorageBackend;
329
+ _storage = mode === 'cookie'
330
+ ? cookieBackend
331
+ : mode === 'sessionStorage'
332
+ ? sessionStorageBackend
333
+ : localStorageBackend;
314
334
  notifySessionChanged();
315
335
  },
316
336
 
@@ -647,7 +667,7 @@ function _getDpopKeyPair(): Promise<CryptoKeyPair> {
647
667
  function _b64urlFromBytes(bytes: ArrayBuffer | Uint8Array): string {
648
668
  const arr = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
649
669
  let s = '';
650
- for (let i = 0; i < arr.length; i++) s += String.fromCharCode(arr[i]);
670
+ for (let i = 0; i < arr.length; i++) s += String.fromCharCode(arr[i] ?? 0);
651
671
  return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
652
672
  }
653
673
 
@@ -669,7 +689,8 @@ async function _makeDpopProof(method: string, url: string): Promise<string | nul
669
689
  const jwk = await _publicJwk(pair.publicKey);
670
690
  const header = { typ: 'dpop+jwt', alg: 'ES256', jwk };
671
691
  // htu = scheme://authority/path without query/fragment.
672
- const htu = url.split('#')[0].split('?')[0];
692
+ const withoutFragment = url.split('#')[0] ?? url;
693
+ const htu = withoutFragment.split('?')[0] ?? withoutFragment;
673
694
  const jti =
674
695
  (crypto.randomUUID && crypto.randomUUID()) ||
675
696
  _b64urlFromBytes(crypto.getRandomValues(new Uint8Array(16)));
@@ -33,7 +33,7 @@ export { API as CfgTotpAPI } from './_cfg_totp';
33
33
  // available via the per-group import: `import { Auth } from
34
34
  // '<api>/_auth'`. To remove the alias, rename the OpenAPI tag on the
35
35
  // backend so the SDK class doesn't collide.
36
- export { CfgAccountsApiKey, CfgAccountsOauth, CfgAccounts, CfgAccountsProfile, CfgAccountsAuth } from './_cfg_accounts';
36
+ export { CfgAccountsApiKey, CfgAccountsOauth, CfgAccountsOtp, CfgAccountsProfile, CfgAccountsAuth } from './_cfg_accounts';
37
37
  export { CfgCentrifugo } from './_cfg_centrifugo';
38
38
  export { CfgTotpBackupCodes, CfgTotp, CfgTotpSetup, CfgTotpVerify } from './_cfg_totp';
39
39
 
@@ -447,7 +447,7 @@
447
447
  "operationId": "cfg_accounts_otp_consent_policy_retrieve",
448
448
  "description": "Marketing-consent checkbox policy for the caller's jurisdiction.\n\nDerived from the edge-provided CF-IPCountry — the same signal stored\nas consent evidence at request time. Unknown country fails safe to\n\"unchecked\".",
449
449
  "tags": [
450
- "cfg_accounts"
450
+ "cfg_accounts_otp"
451
451
  ],
452
452
  "security": [
453
453
  {
@@ -481,7 +481,7 @@
481
481
  "operationId": "cfg_accounts_otp_request_create",
482
482
  "description": "Request OTP code to email.",
483
483
  "tags": [
484
- "cfg_accounts"
484
+ "cfg_accounts_otp"
485
485
  ],
486
486
  "requestBody": {
487
487
  "content": {
@@ -555,7 +555,7 @@
555
555
  "operationId": "cfg_accounts_otp_verify_create",
556
556
  "description": "Verify OTP code and return JWT tokens or 2FA session.\n\nIf user has 2FA enabled:\n- Returns requires_2fa=True with session_id\n- Client must complete 2FA verification at /cfg/totp/verify/\n\nIf user has no 2FA:\n- Returns JWT tokens and user data directly",
557
557
  "tags": [
558
- "cfg_accounts"
558
+ "cfg_accounts_otp"
559
559
  ],
560
560
  "requestBody": {
561
561
  "content": {
@@ -805,16 +805,6 @@
805
805
  "summary": "Profile Update with Avatar"
806
806
  }
807
807
  }
808
- },
809
- "multipart/form-data": {
810
- "schema": {
811
- "$ref": "#/components/schemas/CfgUserUpdateRequest"
812
- }
813
- },
814
- "application/x-www-form-urlencoded": {
815
- "schema": {
816
- "$ref": "#/components/schemas/CfgUserUpdateRequest"
817
- }
818
808
  }
819
809
  }
820
810
  },
@@ -885,16 +875,6 @@
885
875
  "summary": "Profile Update with Avatar"
886
876
  }
887
877
  }
888
- },
889
- "multipart/form-data": {
890
- "schema": {
891
- "$ref": "#/components/schemas/PatchedCfgUserUpdateRequest"
892
- }
893
- },
894
- "application/x-www-form-urlencoded": {
895
- "schema": {
896
- "$ref": "#/components/schemas/PatchedCfgUserUpdateRequest"
897
- }
898
878
  }
899
879
  }
900
880
  },
@@ -967,16 +947,6 @@
967
947
  "summary": "Valid Profile Update"
968
948
  }
969
949
  }
970
- },
971
- "multipart/form-data": {
972
- "schema": {
973
- "$ref": "#/components/schemas/CfgUserUpdateRequest"
974
- }
975
- },
976
- "application/x-www-form-urlencoded": {
977
- "schema": {
978
- "$ref": "#/components/schemas/CfgUserUpdateRequest"
979
- }
980
950
  }
981
951
  }
982
952
  },
@@ -1047,16 +1017,6 @@
1047
1017
  "summary": "Valid Profile Update"
1048
1018
  }
1049
1019
  }
1050
- },
1051
- "multipart/form-data": {
1052
- "schema": {
1053
- "$ref": "#/components/schemas/PatchedCfgUserUpdateRequest"
1054
- }
1055
- },
1056
- "application/x-www-form-urlencoded": {
1057
- "schema": {
1058
- "$ref": "#/components/schemas/PatchedCfgUserUpdateRequest"
1059
- }
1060
1020
  }
1061
1021
  }
1062
1022
  },
@@ -2206,6 +2166,11 @@
2206
2166
  "type": "string",
2207
2167
  "format": "uri",
2208
2168
  "description": "Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path"
2169
+ },
2170
+ "remember_me": {
2171
+ "type": "boolean",
2172
+ "default": false,
2173
+ "description": "Keep this browser signed in for 30 days"
2209
2174
  }
2210
2175
  },
2211
2176
  "required": [
@@ -2385,6 +2350,10 @@
2385
2350
  "should_prompt_2fa": {
2386
2351
  "type": "boolean",
2387
2352
  "description": "True if user should be prompted to enable 2FA"
2353
+ },
2354
+ "persistent_session": {
2355
+ "type": "boolean",
2356
+ "description": "Whether this login should persist across browser restarts"
2388
2357
  }
2389
2358
  }
2390
2359
  },
@@ -2488,6 +2457,11 @@
2488
2457
  "type": "string",
2489
2458
  "format": "uri",
2490
2459
  "description": "Source URL for tracking login (e.g., https://my.djangocfg.com)"
2460
+ },
2461
+ "remember_me": {
2462
+ "type": "boolean",
2463
+ "default": false,
2464
+ "description": "Keep this browser signed in for 30 days"
2491
2465
  }
2492
2466
  },
2493
2467
  "required": [
@@ -2540,6 +2514,10 @@
2540
2514
  "should_prompt_2fa": {
2541
2515
  "type": "boolean",
2542
2516
  "description": "Whether user should be prompted to enable 2FA"
2517
+ },
2518
+ "persistent_session": {
2519
+ "type": "boolean",
2520
+ "description": "Whether this login should persist across browser restarts"
2543
2521
  }
2544
2522
  }
2545
2523
  },
@@ -3019,6 +2997,10 @@
3019
2997
  ],
3020
2998
  "description": "User profile data"
3021
2999
  },
3000
+ "persistent_session": {
3001
+ "type": "boolean",
3002
+ "description": "Whether this login should persist across browser restarts"
3003
+ },
3022
3004
  "remaining_backup_codes": {
3023
3005
  "type": "integer",
3024
3006
  "description": "Number of remaining backup codes (if backup code was used)"
@@ -3031,6 +3013,7 @@
3031
3013
  "required": [
3032
3014
  "access_token",
3033
3015
  "message",
3016
+ "persistent_session",
3034
3017
  "refresh_token",
3035
3018
  "user"
3036
3019
  ]
@@ -197,7 +197,7 @@ export class CfgAccountsOauth {
197
197
  }
198
198
  }
199
199
 
200
- export class CfgAccounts {
200
+ export class CfgAccountsOtp {
201
201
  /**
202
202
  * Marketing-consent checkbox policy for the caller's jurisdiction.
203
203
  *
@@ -375,6 +375,10 @@ export type OAuthCallbackRequestRequest = {
375
375
  * Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path
376
376
  */
377
377
  redirect_uri?: string;
378
+ /**
379
+ * Keep this browser signed in for 30 days
380
+ */
381
+ remember_me?: boolean;
378
382
  };
379
383
 
380
384
  /**
@@ -504,6 +508,10 @@ export type OAuthTokenResponse = {
504
508
  * True if user should be prompted to enable 2FA
505
509
  */
506
510
  should_prompt_2fa?: boolean;
511
+ /**
512
+ * Whether this login should persist across browser restarts
513
+ */
514
+ persistent_session?: boolean;
507
515
  };
508
516
 
509
517
  /**
@@ -583,6 +591,10 @@ export type OtpVerifyRequest = {
583
591
  * Source URL for tracking login (e.g., https://my.djangocfg.com)
584
592
  */
585
593
  source_url?: string;
594
+ /**
595
+ * Keep this browser signed in for 30 days
596
+ */
597
+ remember_me?: boolean;
586
598
  };
587
599
 
588
600
  /**
@@ -623,6 +635,10 @@ export type OtpVerifyResponse = {
623
635
  * Whether user should be prompted to enable 2FA
624
636
  */
625
637
  should_prompt_2fa?: boolean;
638
+ /**
639
+ * Whether this login should persist across browser restarts
640
+ */
641
+ persistent_session?: boolean;
626
642
  };
627
643
 
628
644
  /**
@@ -824,6 +840,10 @@ export type VerifyResponse = {
824
840
  * User profile data
825
841
  */
826
842
  user: TotpVerifyUser;
843
+ /**
844
+ * Whether this login should persist across browser restarts
845
+ */
846
+ persistent_session: boolean;
827
847
  /**
828
848
  * Number of remaining backup codes (if backup code was used)
829
849
  */
@@ -1016,6 +1036,10 @@ export type OtpVerifyResponseWritable = {
1016
1036
  * Whether user should be prompted to enable 2FA
1017
1037
  */
1018
1038
  should_prompt_2fa?: boolean;
1039
+ /**
1040
+ * Whether this login should persist across browser restarts
1041
+ */
1042
+ persistent_session?: boolean;
1019
1043
  };
1020
1044
 
1021
1045
  export type TokenRefreshWritable = {
@@ -1065,6 +1089,10 @@ export type VerifyResponseWritable = {
1065
1089
  * User profile data
1066
1090
  */
1067
1091
  user: TotpVerifyUserWritable;
1092
+ /**
1093
+ * Whether this login should persist across browser restarts
1094
+ */
1095
+ persistent_session: boolean;
1068
1096
  /**
1069
1097
  * Number of remaining backup codes (if backup code was used)
1070
1098
  */