@djangocfg/api 2.1.599 → 2.1.601
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/clients.d.cts
CHANGED
|
@@ -634,7 +634,7 @@ declare enum MarketingConsentDefaultEnum {
|
|
|
634
634
|
*/
|
|
635
635
|
type OAuthAuthorizeRequestRequest = {
|
|
636
636
|
/**
|
|
637
|
-
*
|
|
637
|
+
* Optional. Must be `<origin>/auth?provider=<id>` for an origin of the resolved site; anything else is rejected with `origin_not_allowed`. Omit it: the server derives it from the request Origin.
|
|
638
638
|
*/
|
|
639
639
|
redirect_uri?: string;
|
|
640
640
|
/**
|
|
@@ -664,11 +664,11 @@ type OAuthCallbackRequestRequest = {
|
|
|
664
664
|
*/
|
|
665
665
|
code: string;
|
|
666
666
|
/**
|
|
667
|
-
* State token
|
|
667
|
+
* State token from the authorize response; single use
|
|
668
668
|
*/
|
|
669
669
|
state: string;
|
|
670
670
|
/**
|
|
671
|
-
*
|
|
671
|
+
* Ignored. The server reuses the redirect URI stored with the state.
|
|
672
672
|
*/
|
|
673
673
|
redirect_uri?: string;
|
|
674
674
|
};
|
|
@@ -681,6 +681,7 @@ type OAuthConnection = {
|
|
|
681
681
|
* OAuth provider name (github, google, etc.)
|
|
682
682
|
*
|
|
683
683
|
* * `github` - GitHub
|
|
684
|
+
* * `google` - Google
|
|
684
685
|
*/
|
|
685
686
|
readonly provider: OAuthProviderEnum;
|
|
686
687
|
readonly provider_display: string;
|
|
@@ -713,6 +714,7 @@ type OAuthDisconnectRequestRequest = {
|
|
|
713
714
|
* OAuth provider to disconnect
|
|
714
715
|
*
|
|
715
716
|
* * `github` - GitHub
|
|
717
|
+
* * `google` - Google
|
|
716
718
|
*/
|
|
717
719
|
provider: OAuthProviderEnum;
|
|
718
720
|
};
|
|
@@ -721,30 +723,103 @@ type OAuthDisconnectRequestRequest = {
|
|
|
721
723
|
*/
|
|
722
724
|
type OAuthError = {
|
|
723
725
|
/**
|
|
724
|
-
* Error code
|
|
725
|
-
|
|
726
|
-
|
|
726
|
+
* Error code (closed set)
|
|
727
|
+
*
|
|
728
|
+
* * `oauth_disabled` - oauth_disabled
|
|
729
|
+
* * `github_oauth_disabled` - github_oauth_disabled
|
|
730
|
+
* * `origin_not_allowed` - origin_not_allowed
|
|
731
|
+
* * `missing_redirect_uri` - missing_redirect_uri
|
|
732
|
+
* * `invalid_state` - invalid_state
|
|
733
|
+
* * `oauth_exchange_failed` - oauth_exchange_failed
|
|
734
|
+
* * `invalid_id_token` - invalid_id_token
|
|
735
|
+
* * `email_missing` - email_missing
|
|
736
|
+
* * `email_not_verified` - email_not_verified
|
|
737
|
+
* * `hosted_domain_not_allowed` - hosted_domain_not_allowed
|
|
738
|
+
* * `account_inactive` - account_inactive
|
|
739
|
+
* * `link_not_allowed` - link_not_allowed
|
|
740
|
+
* * `rate_limited` - rate_limited
|
|
741
|
+
* * `provider_unavailable` - provider_unavailable
|
|
742
|
+
* * `server_error` - server_error
|
|
743
|
+
* * `not_found` - not_found
|
|
744
|
+
*/
|
|
745
|
+
error: OAuthErrorCodeEnum;
|
|
727
746
|
/**
|
|
728
747
|
* Human-readable error description
|
|
729
748
|
*/
|
|
730
749
|
error_description?: string;
|
|
731
750
|
};
|
|
751
|
+
/**
|
|
752
|
+
* * `oauth_disabled` - oauth_disabled
|
|
753
|
+
* * `github_oauth_disabled` - github_oauth_disabled
|
|
754
|
+
* * `origin_not_allowed` - origin_not_allowed
|
|
755
|
+
* * `missing_redirect_uri` - missing_redirect_uri
|
|
756
|
+
* * `invalid_state` - invalid_state
|
|
757
|
+
* * `oauth_exchange_failed` - oauth_exchange_failed
|
|
758
|
+
* * `invalid_id_token` - invalid_id_token
|
|
759
|
+
* * `email_missing` - email_missing
|
|
760
|
+
* * `email_not_verified` - email_not_verified
|
|
761
|
+
* * `hosted_domain_not_allowed` - hosted_domain_not_allowed
|
|
762
|
+
* * `account_inactive` - account_inactive
|
|
763
|
+
* * `link_not_allowed` - link_not_allowed
|
|
764
|
+
* * `rate_limited` - rate_limited
|
|
765
|
+
* * `provider_unavailable` - provider_unavailable
|
|
766
|
+
* * `server_error` - server_error
|
|
767
|
+
* * `not_found` - not_found
|
|
768
|
+
*/
|
|
769
|
+
declare enum OAuthErrorCodeEnum {
|
|
770
|
+
OAUTH_DISABLED = "oauth_disabled",
|
|
771
|
+
GITHUB_OAUTH_DISABLED = "github_oauth_disabled",
|
|
772
|
+
ORIGIN_NOT_ALLOWED = "origin_not_allowed",
|
|
773
|
+
MISSING_REDIRECT_URI = "missing_redirect_uri",
|
|
774
|
+
INVALID_STATE = "invalid_state",
|
|
775
|
+
OAUTH_EXCHANGE_FAILED = "oauth_exchange_failed",
|
|
776
|
+
INVALID_ID_TOKEN = "invalid_id_token",
|
|
777
|
+
EMAIL_MISSING = "email_missing",
|
|
778
|
+
EMAIL_NOT_VERIFIED = "email_not_verified",
|
|
779
|
+
HOSTED_DOMAIN_NOT_ALLOWED = "hosted_domain_not_allowed",
|
|
780
|
+
ACCOUNT_INACTIVE = "account_inactive",
|
|
781
|
+
LINK_NOT_ALLOWED = "link_not_allowed",
|
|
782
|
+
RATE_LIMITED = "rate_limited",
|
|
783
|
+
PROVIDER_UNAVAILABLE = "provider_unavailable",
|
|
784
|
+
SERVER_ERROR = "server_error",
|
|
785
|
+
NOT_FOUND = "not_found"
|
|
786
|
+
}
|
|
732
787
|
/**
|
|
733
788
|
* * `github` - GitHub
|
|
789
|
+
* * `google` - Google
|
|
734
790
|
*/
|
|
735
791
|
declare enum OAuthProviderEnum {
|
|
736
|
-
GITHUB = "github"
|
|
792
|
+
GITHUB = "github",
|
|
793
|
+
GOOGLE = "google"
|
|
737
794
|
}
|
|
795
|
+
/**
|
|
796
|
+
* One enabled sign-in provider.
|
|
797
|
+
*/
|
|
798
|
+
type OAuthProviderInfo = {
|
|
799
|
+
/**
|
|
800
|
+
* Provider id
|
|
801
|
+
*
|
|
802
|
+
* * `github` - GitHub
|
|
803
|
+
* * `google` - Google
|
|
804
|
+
*/
|
|
805
|
+
id: OAuthProviderEnum;
|
|
806
|
+
/**
|
|
807
|
+
* Display name
|
|
808
|
+
*/
|
|
809
|
+
name: string;
|
|
810
|
+
/**
|
|
811
|
+
* Icon key
|
|
812
|
+
*/
|
|
813
|
+
icon: string;
|
|
814
|
+
};
|
|
738
815
|
/**
|
|
739
816
|
* Response with available OAuth providers.
|
|
740
817
|
*/
|
|
741
818
|
type OAuthProvidersResponse = {
|
|
742
819
|
/**
|
|
743
|
-
*
|
|
820
|
+
* Providers that are configured, in display order. The login screen shows exactly these.
|
|
744
821
|
*/
|
|
745
|
-
providers: Array<
|
|
746
|
-
[key: string]: unknown;
|
|
747
|
-
}>;
|
|
822
|
+
providers: Array<OAuthProviderInfo>;
|
|
748
823
|
};
|
|
749
824
|
/**
|
|
750
825
|
* Response with JWT tokens after OAuth authentication.
|
|
@@ -1394,6 +1469,7 @@ type CfgAccountsOauthGithubAuthorizeCreateData = {
|
|
|
1394
1469
|
url: '/cfg/accounts/oauth/github/authorize/';
|
|
1395
1470
|
};
|
|
1396
1471
|
type CfgAccountsOauthGithubAuthorizeCreateErrors = {
|
|
1472
|
+
400: OAuthError;
|
|
1397
1473
|
503: OAuthError;
|
|
1398
1474
|
};
|
|
1399
1475
|
type CfgAccountsOauthGithubAuthorizeCreateResponses = {
|
|
@@ -1407,10 +1483,43 @@ type CfgAccountsOauthGithubCallbackCreateData = {
|
|
|
1407
1483
|
};
|
|
1408
1484
|
type CfgAccountsOauthGithubCallbackCreateErrors = {
|
|
1409
1485
|
400: OAuthError;
|
|
1486
|
+
403: OAuthError;
|
|
1487
|
+
429: OAuthError;
|
|
1488
|
+
502: OAuthError;
|
|
1489
|
+
503: OAuthError;
|
|
1410
1490
|
};
|
|
1411
1491
|
type CfgAccountsOauthGithubCallbackCreateResponses = {
|
|
1412
1492
|
200: OAuthTokenResponse;
|
|
1413
1493
|
};
|
|
1494
|
+
type CfgAccountsOauthGoogleAuthorizeCreateData = {
|
|
1495
|
+
body?: OAuthAuthorizeRequestRequest;
|
|
1496
|
+
path?: never;
|
|
1497
|
+
query?: never;
|
|
1498
|
+
url: '/cfg/accounts/oauth/google/authorize/';
|
|
1499
|
+
};
|
|
1500
|
+
type CfgAccountsOauthGoogleAuthorizeCreateErrors = {
|
|
1501
|
+
400: OAuthError;
|
|
1502
|
+
503: OAuthError;
|
|
1503
|
+
};
|
|
1504
|
+
type CfgAccountsOauthGoogleAuthorizeCreateResponses = {
|
|
1505
|
+
200: OAuthAuthorizeResponse;
|
|
1506
|
+
};
|
|
1507
|
+
type CfgAccountsOauthGoogleCallbackCreateData = {
|
|
1508
|
+
body: OAuthCallbackRequestRequest;
|
|
1509
|
+
path?: never;
|
|
1510
|
+
query?: never;
|
|
1511
|
+
url: '/cfg/accounts/oauth/google/callback/';
|
|
1512
|
+
};
|
|
1513
|
+
type CfgAccountsOauthGoogleCallbackCreateErrors = {
|
|
1514
|
+
400: OAuthError;
|
|
1515
|
+
403: OAuthError;
|
|
1516
|
+
429: OAuthError;
|
|
1517
|
+
502: OAuthError;
|
|
1518
|
+
503: OAuthError;
|
|
1519
|
+
};
|
|
1520
|
+
type CfgAccountsOauthGoogleCallbackCreateResponses = {
|
|
1521
|
+
200: OAuthTokenResponse;
|
|
1522
|
+
};
|
|
1414
1523
|
type CfgAccountsOauthProvidersRetrieveData = {
|
|
1415
1524
|
body?: never;
|
|
1416
1525
|
path?: never;
|
|
@@ -1806,19 +1915,31 @@ declare class CfgAccountsOauth {
|
|
|
1806
1915
|
/**
|
|
1807
1916
|
* Start GitHub OAuth
|
|
1808
1917
|
*
|
|
1809
|
-
* Generate GitHub
|
|
1918
|
+
* Generate the GitHub authorization URL. Redirect the user to it to start authentication. The redirect URI is derived from the request Origin.
|
|
1810
1919
|
*/
|
|
1811
1920
|
static cfgAccountsOauthGithubAuthorizeCreate<ThrowOnError extends boolean = false>(options?: Options<CfgAccountsOauthGithubAuthorizeCreateData, ThrowOnError>): RequestResult<CfgAccountsOauthGithubAuthorizeCreateResponses, CfgAccountsOauthGithubAuthorizeCreateErrors, ThrowOnError>;
|
|
1812
1921
|
/**
|
|
1813
1922
|
* Complete GitHub OAuth
|
|
1814
1923
|
*
|
|
1815
|
-
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
1924
|
+
* Exchange the authorization code for JWT tokens. Call this after GitHub redirects back with a code. The state is single use.
|
|
1816
1925
|
*/
|
|
1817
1926
|
static cfgAccountsOauthGithubCallbackCreate<ThrowOnError extends boolean = false>(options: Options<CfgAccountsOauthGithubCallbackCreateData, ThrowOnError>): RequestResult<CfgAccountsOauthGithubCallbackCreateResponses, CfgAccountsOauthGithubCallbackCreateErrors, ThrowOnError>;
|
|
1927
|
+
/**
|
|
1928
|
+
* Start Google OAuth
|
|
1929
|
+
*
|
|
1930
|
+
* Generate the Google authorization URL. Redirect the user to it to start authentication. The redirect URI is derived from the request Origin.
|
|
1931
|
+
*/
|
|
1932
|
+
static cfgAccountsOauthGoogleAuthorizeCreate<ThrowOnError extends boolean = false>(options?: Options<CfgAccountsOauthGoogleAuthorizeCreateData, ThrowOnError>): RequestResult<CfgAccountsOauthGoogleAuthorizeCreateResponses, CfgAccountsOauthGoogleAuthorizeCreateErrors, ThrowOnError>;
|
|
1933
|
+
/**
|
|
1934
|
+
* Complete Google OAuth
|
|
1935
|
+
*
|
|
1936
|
+
* Exchange the authorization code for JWT tokens. Call this after Google redirects back with a code. The state is single use.
|
|
1937
|
+
*/
|
|
1938
|
+
static cfgAccountsOauthGoogleCallbackCreate<ThrowOnError extends boolean = false>(options: Options<CfgAccountsOauthGoogleCallbackCreateData, ThrowOnError>): RequestResult<CfgAccountsOauthGoogleCallbackCreateResponses, CfgAccountsOauthGoogleCallbackCreateErrors, ThrowOnError>;
|
|
1818
1939
|
/**
|
|
1819
1940
|
* List OAuth providers
|
|
1820
1941
|
*
|
|
1821
|
-
*
|
|
1942
|
+
* Providers that are configured, in display order. The login screen shows exactly these buttons.
|
|
1822
1943
|
*/
|
|
1823
1944
|
static cfgAccountsOauthProvidersRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgAccountsOauthProvidersRetrieveData, ThrowOnError>): RequestResult<CfgAccountsOauthProvidersRetrieveResponses, unknown, ThrowOnError>;
|
|
1824
1945
|
}
|
package/dist/clients.d.ts
CHANGED
|
@@ -634,7 +634,7 @@ declare enum MarketingConsentDefaultEnum {
|
|
|
634
634
|
*/
|
|
635
635
|
type OAuthAuthorizeRequestRequest = {
|
|
636
636
|
/**
|
|
637
|
-
*
|
|
637
|
+
* Optional. Must be `<origin>/auth?provider=<id>` for an origin of the resolved site; anything else is rejected with `origin_not_allowed`. Omit it: the server derives it from the request Origin.
|
|
638
638
|
*/
|
|
639
639
|
redirect_uri?: string;
|
|
640
640
|
/**
|
|
@@ -664,11 +664,11 @@ type OAuthCallbackRequestRequest = {
|
|
|
664
664
|
*/
|
|
665
665
|
code: string;
|
|
666
666
|
/**
|
|
667
|
-
* State token
|
|
667
|
+
* State token from the authorize response; single use
|
|
668
668
|
*/
|
|
669
669
|
state: string;
|
|
670
670
|
/**
|
|
671
|
-
*
|
|
671
|
+
* Ignored. The server reuses the redirect URI stored with the state.
|
|
672
672
|
*/
|
|
673
673
|
redirect_uri?: string;
|
|
674
674
|
};
|
|
@@ -681,6 +681,7 @@ type OAuthConnection = {
|
|
|
681
681
|
* OAuth provider name (github, google, etc.)
|
|
682
682
|
*
|
|
683
683
|
* * `github` - GitHub
|
|
684
|
+
* * `google` - Google
|
|
684
685
|
*/
|
|
685
686
|
readonly provider: OAuthProviderEnum;
|
|
686
687
|
readonly provider_display: string;
|
|
@@ -713,6 +714,7 @@ type OAuthDisconnectRequestRequest = {
|
|
|
713
714
|
* OAuth provider to disconnect
|
|
714
715
|
*
|
|
715
716
|
* * `github` - GitHub
|
|
717
|
+
* * `google` - Google
|
|
716
718
|
*/
|
|
717
719
|
provider: OAuthProviderEnum;
|
|
718
720
|
};
|
|
@@ -721,30 +723,103 @@ type OAuthDisconnectRequestRequest = {
|
|
|
721
723
|
*/
|
|
722
724
|
type OAuthError = {
|
|
723
725
|
/**
|
|
724
|
-
* Error code
|
|
725
|
-
|
|
726
|
-
|
|
726
|
+
* Error code (closed set)
|
|
727
|
+
*
|
|
728
|
+
* * `oauth_disabled` - oauth_disabled
|
|
729
|
+
* * `github_oauth_disabled` - github_oauth_disabled
|
|
730
|
+
* * `origin_not_allowed` - origin_not_allowed
|
|
731
|
+
* * `missing_redirect_uri` - missing_redirect_uri
|
|
732
|
+
* * `invalid_state` - invalid_state
|
|
733
|
+
* * `oauth_exchange_failed` - oauth_exchange_failed
|
|
734
|
+
* * `invalid_id_token` - invalid_id_token
|
|
735
|
+
* * `email_missing` - email_missing
|
|
736
|
+
* * `email_not_verified` - email_not_verified
|
|
737
|
+
* * `hosted_domain_not_allowed` - hosted_domain_not_allowed
|
|
738
|
+
* * `account_inactive` - account_inactive
|
|
739
|
+
* * `link_not_allowed` - link_not_allowed
|
|
740
|
+
* * `rate_limited` - rate_limited
|
|
741
|
+
* * `provider_unavailable` - provider_unavailable
|
|
742
|
+
* * `server_error` - server_error
|
|
743
|
+
* * `not_found` - not_found
|
|
744
|
+
*/
|
|
745
|
+
error: OAuthErrorCodeEnum;
|
|
727
746
|
/**
|
|
728
747
|
* Human-readable error description
|
|
729
748
|
*/
|
|
730
749
|
error_description?: string;
|
|
731
750
|
};
|
|
751
|
+
/**
|
|
752
|
+
* * `oauth_disabled` - oauth_disabled
|
|
753
|
+
* * `github_oauth_disabled` - github_oauth_disabled
|
|
754
|
+
* * `origin_not_allowed` - origin_not_allowed
|
|
755
|
+
* * `missing_redirect_uri` - missing_redirect_uri
|
|
756
|
+
* * `invalid_state` - invalid_state
|
|
757
|
+
* * `oauth_exchange_failed` - oauth_exchange_failed
|
|
758
|
+
* * `invalid_id_token` - invalid_id_token
|
|
759
|
+
* * `email_missing` - email_missing
|
|
760
|
+
* * `email_not_verified` - email_not_verified
|
|
761
|
+
* * `hosted_domain_not_allowed` - hosted_domain_not_allowed
|
|
762
|
+
* * `account_inactive` - account_inactive
|
|
763
|
+
* * `link_not_allowed` - link_not_allowed
|
|
764
|
+
* * `rate_limited` - rate_limited
|
|
765
|
+
* * `provider_unavailable` - provider_unavailable
|
|
766
|
+
* * `server_error` - server_error
|
|
767
|
+
* * `not_found` - not_found
|
|
768
|
+
*/
|
|
769
|
+
declare enum OAuthErrorCodeEnum {
|
|
770
|
+
OAUTH_DISABLED = "oauth_disabled",
|
|
771
|
+
GITHUB_OAUTH_DISABLED = "github_oauth_disabled",
|
|
772
|
+
ORIGIN_NOT_ALLOWED = "origin_not_allowed",
|
|
773
|
+
MISSING_REDIRECT_URI = "missing_redirect_uri",
|
|
774
|
+
INVALID_STATE = "invalid_state",
|
|
775
|
+
OAUTH_EXCHANGE_FAILED = "oauth_exchange_failed",
|
|
776
|
+
INVALID_ID_TOKEN = "invalid_id_token",
|
|
777
|
+
EMAIL_MISSING = "email_missing",
|
|
778
|
+
EMAIL_NOT_VERIFIED = "email_not_verified",
|
|
779
|
+
HOSTED_DOMAIN_NOT_ALLOWED = "hosted_domain_not_allowed",
|
|
780
|
+
ACCOUNT_INACTIVE = "account_inactive",
|
|
781
|
+
LINK_NOT_ALLOWED = "link_not_allowed",
|
|
782
|
+
RATE_LIMITED = "rate_limited",
|
|
783
|
+
PROVIDER_UNAVAILABLE = "provider_unavailable",
|
|
784
|
+
SERVER_ERROR = "server_error",
|
|
785
|
+
NOT_FOUND = "not_found"
|
|
786
|
+
}
|
|
732
787
|
/**
|
|
733
788
|
* * `github` - GitHub
|
|
789
|
+
* * `google` - Google
|
|
734
790
|
*/
|
|
735
791
|
declare enum OAuthProviderEnum {
|
|
736
|
-
GITHUB = "github"
|
|
792
|
+
GITHUB = "github",
|
|
793
|
+
GOOGLE = "google"
|
|
737
794
|
}
|
|
795
|
+
/**
|
|
796
|
+
* One enabled sign-in provider.
|
|
797
|
+
*/
|
|
798
|
+
type OAuthProviderInfo = {
|
|
799
|
+
/**
|
|
800
|
+
* Provider id
|
|
801
|
+
*
|
|
802
|
+
* * `github` - GitHub
|
|
803
|
+
* * `google` - Google
|
|
804
|
+
*/
|
|
805
|
+
id: OAuthProviderEnum;
|
|
806
|
+
/**
|
|
807
|
+
* Display name
|
|
808
|
+
*/
|
|
809
|
+
name: string;
|
|
810
|
+
/**
|
|
811
|
+
* Icon key
|
|
812
|
+
*/
|
|
813
|
+
icon: string;
|
|
814
|
+
};
|
|
738
815
|
/**
|
|
739
816
|
* Response with available OAuth providers.
|
|
740
817
|
*/
|
|
741
818
|
type OAuthProvidersResponse = {
|
|
742
819
|
/**
|
|
743
|
-
*
|
|
820
|
+
* Providers that are configured, in display order. The login screen shows exactly these.
|
|
744
821
|
*/
|
|
745
|
-
providers: Array<
|
|
746
|
-
[key: string]: unknown;
|
|
747
|
-
}>;
|
|
822
|
+
providers: Array<OAuthProviderInfo>;
|
|
748
823
|
};
|
|
749
824
|
/**
|
|
750
825
|
* Response with JWT tokens after OAuth authentication.
|
|
@@ -1394,6 +1469,7 @@ type CfgAccountsOauthGithubAuthorizeCreateData = {
|
|
|
1394
1469
|
url: '/cfg/accounts/oauth/github/authorize/';
|
|
1395
1470
|
};
|
|
1396
1471
|
type CfgAccountsOauthGithubAuthorizeCreateErrors = {
|
|
1472
|
+
400: OAuthError;
|
|
1397
1473
|
503: OAuthError;
|
|
1398
1474
|
};
|
|
1399
1475
|
type CfgAccountsOauthGithubAuthorizeCreateResponses = {
|
|
@@ -1407,10 +1483,43 @@ type CfgAccountsOauthGithubCallbackCreateData = {
|
|
|
1407
1483
|
};
|
|
1408
1484
|
type CfgAccountsOauthGithubCallbackCreateErrors = {
|
|
1409
1485
|
400: OAuthError;
|
|
1486
|
+
403: OAuthError;
|
|
1487
|
+
429: OAuthError;
|
|
1488
|
+
502: OAuthError;
|
|
1489
|
+
503: OAuthError;
|
|
1410
1490
|
};
|
|
1411
1491
|
type CfgAccountsOauthGithubCallbackCreateResponses = {
|
|
1412
1492
|
200: OAuthTokenResponse;
|
|
1413
1493
|
};
|
|
1494
|
+
type CfgAccountsOauthGoogleAuthorizeCreateData = {
|
|
1495
|
+
body?: OAuthAuthorizeRequestRequest;
|
|
1496
|
+
path?: never;
|
|
1497
|
+
query?: never;
|
|
1498
|
+
url: '/cfg/accounts/oauth/google/authorize/';
|
|
1499
|
+
};
|
|
1500
|
+
type CfgAccountsOauthGoogleAuthorizeCreateErrors = {
|
|
1501
|
+
400: OAuthError;
|
|
1502
|
+
503: OAuthError;
|
|
1503
|
+
};
|
|
1504
|
+
type CfgAccountsOauthGoogleAuthorizeCreateResponses = {
|
|
1505
|
+
200: OAuthAuthorizeResponse;
|
|
1506
|
+
};
|
|
1507
|
+
type CfgAccountsOauthGoogleCallbackCreateData = {
|
|
1508
|
+
body: OAuthCallbackRequestRequest;
|
|
1509
|
+
path?: never;
|
|
1510
|
+
query?: never;
|
|
1511
|
+
url: '/cfg/accounts/oauth/google/callback/';
|
|
1512
|
+
};
|
|
1513
|
+
type CfgAccountsOauthGoogleCallbackCreateErrors = {
|
|
1514
|
+
400: OAuthError;
|
|
1515
|
+
403: OAuthError;
|
|
1516
|
+
429: OAuthError;
|
|
1517
|
+
502: OAuthError;
|
|
1518
|
+
503: OAuthError;
|
|
1519
|
+
};
|
|
1520
|
+
type CfgAccountsOauthGoogleCallbackCreateResponses = {
|
|
1521
|
+
200: OAuthTokenResponse;
|
|
1522
|
+
};
|
|
1414
1523
|
type CfgAccountsOauthProvidersRetrieveData = {
|
|
1415
1524
|
body?: never;
|
|
1416
1525
|
path?: never;
|
|
@@ -1806,19 +1915,31 @@ declare class CfgAccountsOauth {
|
|
|
1806
1915
|
/**
|
|
1807
1916
|
* Start GitHub OAuth
|
|
1808
1917
|
*
|
|
1809
|
-
* Generate GitHub
|
|
1918
|
+
* Generate the GitHub authorization URL. Redirect the user to it to start authentication. The redirect URI is derived from the request Origin.
|
|
1810
1919
|
*/
|
|
1811
1920
|
static cfgAccountsOauthGithubAuthorizeCreate<ThrowOnError extends boolean = false>(options?: Options<CfgAccountsOauthGithubAuthorizeCreateData, ThrowOnError>): RequestResult<CfgAccountsOauthGithubAuthorizeCreateResponses, CfgAccountsOauthGithubAuthorizeCreateErrors, ThrowOnError>;
|
|
1812
1921
|
/**
|
|
1813
1922
|
* Complete GitHub OAuth
|
|
1814
1923
|
*
|
|
1815
|
-
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
1924
|
+
* Exchange the authorization code for JWT tokens. Call this after GitHub redirects back with a code. The state is single use.
|
|
1816
1925
|
*/
|
|
1817
1926
|
static cfgAccountsOauthGithubCallbackCreate<ThrowOnError extends boolean = false>(options: Options<CfgAccountsOauthGithubCallbackCreateData, ThrowOnError>): RequestResult<CfgAccountsOauthGithubCallbackCreateResponses, CfgAccountsOauthGithubCallbackCreateErrors, ThrowOnError>;
|
|
1927
|
+
/**
|
|
1928
|
+
* Start Google OAuth
|
|
1929
|
+
*
|
|
1930
|
+
* Generate the Google authorization URL. Redirect the user to it to start authentication. The redirect URI is derived from the request Origin.
|
|
1931
|
+
*/
|
|
1932
|
+
static cfgAccountsOauthGoogleAuthorizeCreate<ThrowOnError extends boolean = false>(options?: Options<CfgAccountsOauthGoogleAuthorizeCreateData, ThrowOnError>): RequestResult<CfgAccountsOauthGoogleAuthorizeCreateResponses, CfgAccountsOauthGoogleAuthorizeCreateErrors, ThrowOnError>;
|
|
1933
|
+
/**
|
|
1934
|
+
* Complete Google OAuth
|
|
1935
|
+
*
|
|
1936
|
+
* Exchange the authorization code for JWT tokens. Call this after Google redirects back with a code. The state is single use.
|
|
1937
|
+
*/
|
|
1938
|
+
static cfgAccountsOauthGoogleCallbackCreate<ThrowOnError extends boolean = false>(options: Options<CfgAccountsOauthGoogleCallbackCreateData, ThrowOnError>): RequestResult<CfgAccountsOauthGoogleCallbackCreateResponses, CfgAccountsOauthGoogleCallbackCreateErrors, ThrowOnError>;
|
|
1818
1939
|
/**
|
|
1819
1940
|
* List OAuth providers
|
|
1820
1941
|
*
|
|
1821
|
-
*
|
|
1942
|
+
* Providers that are configured, in display order. The login screen shows exactly these buttons.
|
|
1822
1943
|
*/
|
|
1823
1944
|
static cfgAccountsOauthProvidersRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgAccountsOauthProvidersRetrieveData, ThrowOnError>): RequestResult<CfgAccountsOauthProvidersRetrieveResponses, unknown, ThrowOnError>;
|
|
1824
1945
|
}
|
package/dist/clients.mjs
CHANGED
|
@@ -79,6 +79,7 @@ var CFG_KEYS = {
|
|
|
79
79
|
redirectUrlTs: k("cfg.auth.redirect_url_ts", "session", true),
|
|
80
80
|
oauthState: k("cfg.auth.oauth_state", "session", true),
|
|
81
81
|
oauthProvider: k("cfg.auth.oauth_provider", "session", true),
|
|
82
|
+
oauthProviders: k("cfg.auth.oauth_providers", "session", false),
|
|
82
83
|
profileCache: k("cfg.profile.cache", "local", true),
|
|
83
84
|
monitorSessionId: k("cfg.monitor.session_id", "local", false),
|
|
84
85
|
monitorSessionCookie: k("cfg.monitor.session_id", "cookie", false),
|
|
@@ -1947,7 +1948,7 @@ var CfgAccountsOauth = class {
|
|
|
1947
1948
|
/**
|
|
1948
1949
|
* Start GitHub OAuth
|
|
1949
1950
|
*
|
|
1950
|
-
* Generate GitHub
|
|
1951
|
+
* Generate the GitHub authorization URL. Redirect the user to it to start authentication. The redirect URI is derived from the request Origin.
|
|
1951
1952
|
*/
|
|
1952
1953
|
static cfgAccountsOauthGithubAuthorizeCreate(options) {
|
|
1953
1954
|
return (options?.client ?? client).post({
|
|
@@ -1962,7 +1963,7 @@ var CfgAccountsOauth = class {
|
|
|
1962
1963
|
/**
|
|
1963
1964
|
* Complete GitHub OAuth
|
|
1964
1965
|
*
|
|
1965
|
-
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
1966
|
+
* Exchange the authorization code for JWT tokens. Call this after GitHub redirects back with a code. The state is single use.
|
|
1966
1967
|
*/
|
|
1967
1968
|
static cfgAccountsOauthGithubCallbackCreate(options) {
|
|
1968
1969
|
return (options.client ?? client).post({
|
|
@@ -1974,10 +1975,40 @@ var CfgAccountsOauth = class {
|
|
|
1974
1975
|
}
|
|
1975
1976
|
});
|
|
1976
1977
|
}
|
|
1978
|
+
/**
|
|
1979
|
+
* Start Google OAuth
|
|
1980
|
+
*
|
|
1981
|
+
* Generate the Google authorization URL. Redirect the user to it to start authentication. The redirect URI is derived from the request Origin.
|
|
1982
|
+
*/
|
|
1983
|
+
static cfgAccountsOauthGoogleAuthorizeCreate(options) {
|
|
1984
|
+
return (options?.client ?? client).post({
|
|
1985
|
+
url: "/cfg/accounts/oauth/google/authorize/",
|
|
1986
|
+
...options,
|
|
1987
|
+
headers: {
|
|
1988
|
+
"Content-Type": "application/json",
|
|
1989
|
+
...options?.headers
|
|
1990
|
+
}
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
/**
|
|
1994
|
+
* Complete Google OAuth
|
|
1995
|
+
*
|
|
1996
|
+
* Exchange the authorization code for JWT tokens. Call this after Google redirects back with a code. The state is single use.
|
|
1997
|
+
*/
|
|
1998
|
+
static cfgAccountsOauthGoogleCallbackCreate(options) {
|
|
1999
|
+
return (options.client ?? client).post({
|
|
2000
|
+
url: "/cfg/accounts/oauth/google/callback/",
|
|
2001
|
+
...options,
|
|
2002
|
+
headers: {
|
|
2003
|
+
"Content-Type": "application/json",
|
|
2004
|
+
...options.headers
|
|
2005
|
+
}
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
1977
2008
|
/**
|
|
1978
2009
|
* List OAuth providers
|
|
1979
2010
|
*
|
|
1980
|
-
*
|
|
2011
|
+
* Providers that are configured, in display order. The login screen shows exactly these buttons.
|
|
1981
2012
|
*/
|
|
1982
2013
|
static cfgAccountsOauthProvidersRetrieve(options) {
|
|
1983
2014
|
return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
|