@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.
- package/README.md +2 -1
- package/dist/OAuthProvidersResponse-QZ566OYR.mjs +25 -0
- package/dist/OAuthProvidersResponse-QZ566OYR.mjs.map +1 -0
- package/dist/auth.cjs +526 -288
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +144 -31
- package/dist/auth.d.ts +144 -31
- package/dist/auth.mjs +409 -213
- package/dist/auth.mjs.map +1 -1
- package/dist/cfg_accounts_oauth_connections_response_200_AutoRef-N532BRPN.mjs +28 -0
- package/dist/cfg_accounts_oauth_connections_response_200_AutoRef-N532BRPN.mjs.map +1 -0
- package/dist/chunk-PCOSFQTH.mjs +10 -0
- package/dist/chunk-PCOSFQTH.mjs.map +1 -0
- package/dist/clients.cjs +34 -3
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +135 -14
- package/dist/clients.d.ts +135 -14
- package/dist/clients.mjs +34 -3
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +1 -0
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.mjs +1 -0
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +34 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +169 -17
- package/dist/index.d.ts +169 -17
- package/dist/index.mjs +34 -3
- package/dist/index.mjs.map +1 -1
- package/dist/storage.cjs +1 -0
- package/dist/storage.cjs.map +1 -1
- package/dist/storage.d.cts +1 -0
- package/dist/storage.d.ts +1 -0
- package/dist/storage.mjs +1 -0
- package/dist/storage.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/noStorageLiterals.test.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/index.ts +2 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGoogleAuthorizeCreate.ts +68 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGoogleCallbackCreate.ts +68 -0
- package/src/_api/generated/_cfg_accounts/openapi.json +263 -19
- package/src/_api/generated/_cfg_accounts/schemas/OAuthCallbackRequestRequest.ts +2 -2
- package/src/_api/generated/_cfg_accounts/schemas/OAuthError.ts +2 -1
- package/src/_api/generated/_cfg_accounts/schemas/OAuthErrorCodeEnum.ts +9 -0
- package/src/_api/generated/_cfg_accounts/schemas/OAuthProviderEnum.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/OAuthProviderInfo.ts +14 -0
- package/src/_api/generated/_cfg_accounts/schemas/OAuthProvidersResponse.ts +2 -1
- package/src/_api/generated/_cfg_accounts/schemas/index.ts +2 -0
- package/src/_api/generated/helpers/keys.ts +1 -0
- package/src/_api/generated/openapi.json +263 -19
- package/src/_api/generated/sdk.gen.ts +36 -4
- package/src/_api/generated/types.gen.ts +136 -11
- package/src/auth/__tests__/oauthErrors.test.ts +23 -0
- package/src/auth/__tests__/passwordLogin.test.tsx +1 -0
- package/src/auth/__tests__/useOAuthLogin.test.tsx +387 -0
- package/src/auth/hooks/index.ts +12 -1
- package/src/auth/hooks/useGithubAuth.ts +15 -225
- package/src/auth/hooks/useOAuthLogin.ts +237 -0
- package/src/auth/hooks/useOAuthProviders.ts +76 -0
- package/src/auth/utils/index.ts +8 -0
- 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
|
|
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
|
-
*
|
|
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 });
|