Skip to content

Commit

Permalink
update oauth requirements (#403)
Browse files Browse the repository at this point in the history
Co-authored-by: Alyssa Wang <[email protected]>
  • Loading branch information
AlyssaWang and AlyssaWang authored Nov 1, 2023
1 parent d0a4884 commit 545caf4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/src/components/InputsModal/InputsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ const InputsModal: FC<InputsModalProps> = ({
const oAuthJSON = JSON.parse(
(inputsMap.get(input.name) as string) || '{ "access_token": null }'
) as OAuthCredentials;
const accessTokenIsEmpty = oAuthJSON.access_token === '';
const refreshIsEmpty =
oAuthJSON.refresh_token !== '' && (!oAuthJSON.token_url || !oAuthJSON.client_id);
oAuthMissingRequiredInput = (accessTokenIsEmpty && !input.optional) || refreshIsEmpty;
const accessTokenIsEmpty = !oAuthJSON.access_token;
const refreshTokenIsEmpty =
!!oAuthJSON.refresh_token && (!oAuthJSON.token_url || !oAuthJSON.client_id);
oAuthMissingRequiredInput = (!input.optional && accessTokenIsEmpty) || refreshTokenIsEmpty;
} catch (e: unknown) {
const errorMessage = e instanceof Error ? e.message : String(e);
enqueueSnackbar(`OAuth credentials incorrectly formatted: ${errorMessage}`, {
Expand Down

0 comments on commit 545caf4

Please sign in to comment.