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:
parent
f15df4409f
commit
a52a3d1663
1 changed files with 2 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { assert, pick } from '@silverhand/essentials';
|
import { pick } from '@silverhand/essentials';
|
||||||
import type { Response } from 'got';
|
import type { Response } from 'got';
|
||||||
import { got, HTTPError } from 'got';
|
import { got, HTTPError } from 'got';
|
||||||
import snakecaseKeys from 'snakecase-keys';
|
import snakecaseKeys from 'snakecase-keys';
|
||||||
|
@ -7,7 +7,7 @@ import { ConnectorError, ConnectorErrorCodes, parseJson } from '@logto/connector
|
||||||
|
|
||||||
import { defaultTimeout } from './constant.js';
|
import { defaultTimeout } from './constant.js';
|
||||||
import type { AccessTokenResponse, OidcConfig } from './types.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 (
|
export const accessTokenRequester = async (
|
||||||
tokenEndpoint: string,
|
tokenEndpoint: string,
|
||||||
|
@ -39,20 +39,9 @@ const accessTokenResponseHandler = async (
|
||||||
throw new ConnectorError(ConnectorErrorCodes.InvalidResponse, result.error);
|
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;
|
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) => {
|
export const getIdToken = async (config: OidcConfig, data: unknown, redirectUri: string) => {
|
||||||
const result = authResponseGuard.safeParse(data);
|
const result = authResponseGuard.safeParse(data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue