@aws-amplify/analytics
Version:
Analytics category of aws-amplify
17 lines (12 loc) • 490 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';
export const resolveCredentials = async () => {
const { credentials, identityId } = await fetchAuthSession();
assertValidationError(
!!credentials,
AnalyticsValidationErrorCode.NoCredentials,
);
return { credentials, identityId };
};