From f1cafbf09679c8aea7006b7649eebc9307583d70 Mon Sep 17 00:00:00 2001 From: avdb13 Date: Sun, 24 Nov 2024 00:06:54 +0000 Subject: [PATCH] feat: add PKCE --- .../create-or-edit-oauth-provider-modal.tsx | 13 +++++++ src/shared/components/home/login.tsx | 36 ++++++++++++++----- .../components/home/oauth/oauth-callback.tsx | 3 ++ .../home/oauth/oauth-provider-list-item.tsx | 4 +++ .../home/oauth/oauth-providers-tab.tsx | 1 + src/shared/utils/helpers/oauth.ts | 19 ++++++++++ 6 files changed, 67 insertions(+), 9 deletions(-) create mode 100644 src/shared/utils/helpers/oauth.ts diff --git a/src/shared/components/common/modal/create-or-edit-oauth-provider-modal.tsx b/src/shared/components/common/modal/create-or-edit-oauth-provider-modal.tsx index a0112f27c7..e7a63e44f4 100644 --- a/src/shared/components/common/modal/create-or-edit-oauth-provider-modal.tsx +++ b/src/shared/components/common/modal/create-or-edit-oauth-provider-modal.tsx @@ -51,6 +51,7 @@ interface ProviderTextFieldProps extends ProviderFieldProps { type ProviderBooleanProperties = | "enabled" + | "use_pkce" | "account_linking_enabled" | "auto_verify_email"; @@ -337,6 +338,18 @@ export default class CreateOrEditOAuthProviderModal extends Component< handleBooleanPropertyChange, )} /> + { show_nsfw: local_oauth_state.show_nsfw, username: local_oauth_state.username, answer: local_oauth_state.answer, + ...(local_oauth_state?.pkce_code_verifier && { + pkce_code_verifier: local_oauth_state.pkce_code_verifier, + }), }); switch (loginRes.state) { diff --git a/src/shared/components/home/oauth/oauth-provider-list-item.tsx b/src/shared/components/home/oauth/oauth-provider-list-item.tsx index e87ae3f1fd..b538e5a2c1 100644 --- a/src/shared/components/home/oauth/oauth-provider-list-item.tsx +++ b/src/shared/components/home/oauth/oauth-provider-list-item.tsx @@ -86,6 +86,10 @@ export default function OAuthProviderListItem({ i18nKey="oauth_account_linking_enabled" data={boolToYesNo(provider.account_linking_enabled)} /> +