From a52a3d16638351a8782738e08a03cf68275aeef0 Mon Sep 17 00:00:00 2001 From: Darcy Ye Date: Mon, 8 Jan 2024 14:45:35 +0800 Subject: [PATCH] chore(connector): remove unused code (#5200) --- packages/connectors/connector-oidc/src/utils.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/connectors/connector-oidc/src/utils.ts b/packages/connectors/connector-oidc/src/utils.ts index 865bf69e3..fa227364d 100644 --- a/packages/connectors/connector-oidc/src/utils.ts +++ b/packages/connectors/connector-oidc/src/utils.ts @@ -1,4 +1,4 @@ -import { assert, pick } from '@silverhand/essentials'; +import { pick } from '@silverhand/essentials'; import type { Response } from 'got'; import { got, HTTPError } from 'got'; import snakecaseKeys from 'snakecase-keys'; @@ -7,7 +7,7 @@ import { ConnectorError, ConnectorErrorCodes, parseJson } from '@logto/connector import { defaultTimeout } from './constant.js'; import type { AccessTokenResponse, OidcConfig } from './types.js'; -import { accessTokenResponseGuard, delimiter, authResponseGuard } from './types.js'; +import { accessTokenResponseGuard, authResponseGuard } from './types.js'; export const accessTokenRequester = async ( tokenEndpoint: string, @@ -39,20 +39,9 @@ const accessTokenResponseHandler = async ( throw new ConnectorError(ConnectorErrorCodes.InvalidResponse, result.error); } - assert( - result.data.access_token, - new ConnectorError(ConnectorErrorCodes.SocialAuthCodeInvalid, { - message: 'Missing `access_token` in token response!', - }) - ); - return result.data; }; -export const isIdTokenInResponseType = (responseType: string) => { - return responseType.split(delimiter).includes('id_token'); -}; - export const getIdToken = async (config: OidcConfig, data: unknown, redirectUri: string) => { const result = authResponseGuard.safeParse(data);