@aws-amplify/analytics
Version:
Analytics category of aws-amplify
23 lines (18 loc) • 520 B
text/typescript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { fetchAuthSession } from '@aws-amplify/core';
import {
AnalyticsValidationErrorCode,
assertValidationError,
} from '../../../errors';
/**
* @internal
*/
export const resolveCredentials = async () => {
const { credentials, identityId } = await fetchAuthSession();
assertValidationError(
!!credentials,
AnalyticsValidationErrorCode.NoCredentials,
);
return { credentials, identityId };
};