@djangocfg/api 2.1.599 → 2.1.600

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 (61) hide show
  1. package/README.md +2 -1
  2. package/dist/OAuthProvidersResponse-QZ566OYR.mjs +25 -0
  3. package/dist/OAuthProvidersResponse-QZ566OYR.mjs.map +1 -0
  4. package/dist/auth.cjs +526 -288
  5. package/dist/auth.cjs.map +1 -1
  6. package/dist/auth.d.cts +144 -31
  7. package/dist/auth.d.ts +144 -31
  8. package/dist/auth.mjs +409 -213
  9. package/dist/auth.mjs.map +1 -1
  10. package/dist/cfg_accounts_oauth_connections_response_200_AutoRef-N532BRPN.mjs +28 -0
  11. package/dist/cfg_accounts_oauth_connections_response_200_AutoRef-N532BRPN.mjs.map +1 -0
  12. package/dist/chunk-PCOSFQTH.mjs +10 -0
  13. package/dist/chunk-PCOSFQTH.mjs.map +1 -0
  14. package/dist/clients.cjs +34 -3
  15. package/dist/clients.cjs.map +1 -1
  16. package/dist/clients.d.cts +135 -14
  17. package/dist/clients.d.ts +135 -14
  18. package/dist/clients.mjs +34 -3
  19. package/dist/clients.mjs.map +1 -1
  20. package/dist/hooks.cjs +1 -0
  21. package/dist/hooks.cjs.map +1 -1
  22. package/dist/hooks.mjs +1 -0
  23. package/dist/hooks.mjs.map +1 -1
  24. package/dist/index.cjs +34 -3
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +169 -17
  27. package/dist/index.d.ts +169 -17
  28. package/dist/index.mjs +34 -3
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/storage.cjs +1 -0
  31. package/dist/storage.cjs.map +1 -1
  32. package/dist/storage.d.cts +1 -0
  33. package/dist/storage.d.ts +1 -0
  34. package/dist/storage.mjs +1 -0
  35. package/dist/storage.mjs.map +1 -1
  36. package/package.json +2 -2
  37. package/src/__tests__/noStorageLiterals.test.ts +1 -1
  38. package/src/_api/generated/_cfg_accounts/hooks/index.ts +2 -0
  39. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGoogleAuthorizeCreate.ts +68 -0
  40. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGoogleCallbackCreate.ts +68 -0
  41. package/src/_api/generated/_cfg_accounts/openapi.json +263 -19
  42. package/src/_api/generated/_cfg_accounts/schemas/OAuthCallbackRequestRequest.ts +2 -2
  43. package/src/_api/generated/_cfg_accounts/schemas/OAuthError.ts +2 -1
  44. package/src/_api/generated/_cfg_accounts/schemas/OAuthErrorCodeEnum.ts +9 -0
  45. package/src/_api/generated/_cfg_accounts/schemas/OAuthProviderEnum.ts +1 -1
  46. package/src/_api/generated/_cfg_accounts/schemas/OAuthProviderInfo.ts +14 -0
  47. package/src/_api/generated/_cfg_accounts/schemas/OAuthProvidersResponse.ts +2 -1
  48. package/src/_api/generated/_cfg_accounts/schemas/index.ts +2 -0
  49. package/src/_api/generated/helpers/keys.ts +1 -0
  50. package/src/_api/generated/openapi.json +263 -19
  51. package/src/_api/generated/sdk.gen.ts +36 -4
  52. package/src/_api/generated/types.gen.ts +136 -11
  53. package/src/auth/__tests__/oauthErrors.test.ts +23 -0
  54. package/src/auth/__tests__/passwordLogin.test.tsx +1 -0
  55. package/src/auth/__tests__/useOAuthLogin.test.tsx +387 -0
  56. package/src/auth/hooks/index.ts +12 -1
  57. package/src/auth/hooks/useGithubAuth.ts +15 -225
  58. package/src/auth/hooks/useOAuthLogin.ts +237 -0
  59. package/src/auth/hooks/useOAuthProviders.ts +76 -0
  60. package/src/auth/utils/index.ts +8 -0
  61. package/src/auth/utils/oauthErrors.ts +45 -0
package/dist/index.cjs CHANGED
@@ -154,6 +154,7 @@ var CFG_KEYS = {
154
154
  redirectUrlTs: k("cfg.auth.redirect_url_ts", "session", true),
155
155
  oauthState: k("cfg.auth.oauth_state", "session", true),
156
156
  oauthProvider: k("cfg.auth.oauth_provider", "session", true),
157
+ oauthProviders: k("cfg.auth.oauth_providers", "session", false),
157
158
  profileCache: k("cfg.profile.cache", "local", true),
158
159
  monitorSessionId: k("cfg.monitor.session_id", "local", false),
159
160
  monitorSessionCookie: k("cfg.monitor.session_id", "cookie", false),
@@ -2022,7 +2023,7 @@ var CfgAccountsOauth = class {
2022
2023
  /**
2023
2024
  * Start GitHub OAuth
2024
2025
  *
2025
- * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
2026
+ * Generate the GitHub authorization URL. Redirect the user to it to start authentication. The redirect URI is derived from the request Origin.
2026
2027
  */
2027
2028
  static cfgAccountsOauthGithubAuthorizeCreate(options) {
2028
2029
  return (options?.client ?? client).post({
@@ -2037,7 +2038,7 @@ var CfgAccountsOauth = class {
2037
2038
  /**
2038
2039
  * Complete GitHub OAuth
2039
2040
  *
2040
- * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
2041
+ * Exchange the authorization code for JWT tokens. Call this after GitHub redirects back with a code. The state is single use.
2041
2042
  */
2042
2043
  static cfgAccountsOauthGithubCallbackCreate(options) {
2043
2044
  return (options.client ?? client).post({
@@ -2049,10 +2050,40 @@ var CfgAccountsOauth = class {
2049
2050
  }
2050
2051
  });
2051
2052
  }
2053
+ /**
2054
+ * Start Google OAuth
2055
+ *
2056
+ * Generate the Google authorization URL. Redirect the user to it to start authentication. The redirect URI is derived from the request Origin.
2057
+ */
2058
+ static cfgAccountsOauthGoogleAuthorizeCreate(options) {
2059
+ return (options?.client ?? client).post({
2060
+ url: "/cfg/accounts/oauth/google/authorize/",
2061
+ ...options,
2062
+ headers: {
2063
+ "Content-Type": "application/json",
2064
+ ...options?.headers
2065
+ }
2066
+ });
2067
+ }
2068
+ /**
2069
+ * Complete Google OAuth
2070
+ *
2071
+ * Exchange the authorization code for JWT tokens. Call this after Google redirects back with a code. The state is single use.
2072
+ */
2073
+ static cfgAccountsOauthGoogleCallbackCreate(options) {
2074
+ return (options.client ?? client).post({
2075
+ url: "/cfg/accounts/oauth/google/callback/",
2076
+ ...options,
2077
+ headers: {
2078
+ "Content-Type": "application/json",
2079
+ ...options.headers
2080
+ }
2081
+ });
2082
+ }
2052
2083
  /**
2053
2084
  * List OAuth providers
2054
2085
  *
2055
- * Get list of available OAuth providers for authentication.
2086
+ * Providers that are configured, in display order. The login screen shows exactly these buttons.
2056
2087
  */
2057
2088
  static cfgAccountsOauthProvidersRetrieve(options) {
2058
2089
  return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });