chore: make client secret optional across grant types (#4363)

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
This commit is contained in:
Akash K
2024-09-27 17:20:26 +05:30
committed by GitHub
parent fc37196354
commit db8cf229ac
16 changed files with 256 additions and 42 deletions

View File

@@ -401,7 +401,7 @@ const supportedGrantTypes = [
return E.right(undefined)
}
const runAction = () => {
const runAction = async () => {
const params: AuthCodeOauthFlowParams = {
authEndpoint: authEndpoint.value,
tokenEndpoint: tokenEndpoint.value,
@@ -420,7 +420,11 @@ const supportedGrantTypes = [
return E.left("VALIDATION_FAILED" as const)
}
authCode.init(parsedArgs.data)
const res = await authCode.init(parsedArgs.data)
if (E.isLeft(res)) {
return res
}
return E.right(undefined)
}
@@ -1047,8 +1051,14 @@ const generateOAuthToken = async () => {
VALIDATION_FAILED: t("authorization.oauth.validation_failed"),
OAUTH_TOKEN_FETCH_FAILED: t("authorization.oauth.token_fetch_failed"),
}
if (res.left in errorMessages) {
// @ts-expect-error - not possible to have a key that doesn't exist
toast.error(errorMessages[res.left])
return
}
toast.error(t("error.something_went_wrong"))
toast.error(errorMessages[res.left])
return
}
}