0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

chore(connector): remove unused code (#5200)

This commit is contained in:
Darcy Ye 2024-01-08 14:45:35 +08:00 committed by GitHub
parent f15df4409f
commit a52a3d1663
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);