UNPKG

@aws-amplify/auth

Version:
34 lines (31 loc) 1.52 kB
import { Amplify, fetchAuthSession } from '@aws-amplify/core'; import { assertTokenProviderConfig, AuthAction } from '@aws-amplify/core/internals/utils'; import { deleteUserAttributes as deleteUserAttributes$1 } from '../utils/clients/CognitoIdentityProvider/index.mjs'; import { getRegion } from '../utils/clients/CognitoIdentityProvider/utils.mjs'; import { assertAuthTokens } from '../utils/types.mjs'; import { getAuthUserAgentValue } from '../../../utils/getAuthUserAgentValue.mjs'; // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 /** * Deletes user attributes. * * @param input - The DeleteUserAttributesInput object * @throws -{@link DeleteUserAttributesException } - Thrown due to invalid attribute. * @throws AuthTokenConfigException - Thrown when the token provider config is invalid. */ async function deleteUserAttributes(input) { const authConfig = Amplify.getConfig().Auth?.Cognito; assertTokenProviderConfig(authConfig); const { userAttributeKeys } = input; const { tokens } = await fetchAuthSession({ forceRefresh: false }); assertAuthTokens(tokens); await deleteUserAttributes$1({ region: getRegion(authConfig.userPoolId), userAgentValue: getAuthUserAgentValue(AuthAction.DeleteUserAttributes), }, { AccessToken: tokens.accessToken.toString(), UserAttributeNames: userAttributeKeys, }); } export { deleteUserAttributes }; //# sourceMappingURL=deleteUserAttributes.mjs.map