diff --git a/client/cognito-api.ts b/client/cognito-api.ts index e75be66..dded81c 100644 --- a/client/cognito-api.ts +++ b/client/cognito-api.ts @@ -73,6 +73,20 @@ interface GetCredentialsForIdentityResponse { IdentityId: string; } +interface GetUserResponse { + MFAOptions: { + AttributeName: string; + DeliveryMedium: string; + }[]; + PreferredMfaSetting: string; + UserAttributes: { + Name: string; + Value: string; + }[]; + UserMFASettingList: string[]; + Username: string; +} + export function isErrorResponse(obj: unknown): obj is ErrorResponse { return ( !!obj && typeof obj === "object" && "__type" in obj && "message" in obj @@ -363,7 +377,7 @@ export async function getUser({ }: { abort?: AbortSignal; accessToken?: string; -}): Promise<{ Name: string; Value: string }[]> { +}) { const { fetch, cognitoIdpEndpoint, proxyApiHeaders } = configure(); const token = accessToken ?? (await retrieveTokens())?.accessToken; return await fetch( @@ -384,7 +398,7 @@ export async function getUser({ } ) .then(throwIfNot2xx) - .then((res) => res.json() as Promise<{ Name: string; Value: string }[]>); + .then((res) => res.json() as Promise); } export async function getCredentialsForIdentity({