Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "chore(auth): debounce refreshAuthTokens (#12845)" #12858

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -6,15 +6,14 @@ import { AuthConfig } from '@aws-amplify/core';
import {
assertTokenProviderConfig,
decodeJWT,
deDupeAsyncFunction,
} from '@aws-amplify/core/internals/utils';
import { initiateAuth } from '../utils/clients/CognitoIdentityProvider';
import { getRegion } from '../utils/clients/CognitoIdentityProvider/utils';
import { assertAuthTokensWithRefreshToken } from '../utils/types';
import { AuthError } from '../../../errors/AuthError';
import { getUserContextData } from './userContextData';

const refreshAuthTokensFunction: TokenRefresher = async ({
export const refreshAuthTokens: TokenRefresher = async ({
tokens,
authConfig,
username,
Expand Down Expand Up @@ -73,5 +72,3 @@ const refreshAuthTokensFunction: TokenRefresher = async ({
username,
};
};

export const refreshAuthTokens = deDupeAsyncFunction(refreshAuthTokensFunction);
16 changes: 8 additions & 8 deletions packages/aws-amplify/package.json
Expand Up @@ -300,13 +300,13 @@
"name": "[Analytics] record (Kinesis)",
"path": "./dist/esm/analytics/kinesis/index.mjs",
"import": "{ record }",
"limit": "44.48 kB"
"limit": "44.47 kB"
},
{
"name": "[Analytics] record (Kinesis Firehose)",
"path": "./dist/esm/analytics/kinesis-firehose/index.mjs",
"import": "{ record }",
"limit": "41.54 kB"
"limit": "41.50 kB"
},
{
"name": "[Analytics] record (Personalize)",
Expand Down Expand Up @@ -384,7 +384,7 @@
"name": "[Auth] confirmSignIn (Cognito)",
"path": "./dist/esm/auth/index.mjs",
"import": "{ confirmSignIn }",
"limit": "25.94 kB"
"limit": "25.89 kB"
},
{
"name": "[Auth] updateMFAPreference (Cognito)",
Expand All @@ -396,19 +396,19 @@
"name": "[Auth] fetchMFAPreference (Cognito)",
"path": "./dist/esm/auth/index.mjs",
"import": "{ fetchMFAPreference }",
"limit": "8.35 kB"
"limit": "8.30 kB"
},
{
"name": "[Auth] verifyTOTPSetup (Cognito)",
"path": "./dist/esm/auth/index.mjs",
"import": "{ verifyTOTPSetup }",
"limit": "9.18 kB"
"limit": "9.13 kB"
},
{
"name": "[Auth] updatePassword (Cognito)",
"path": "./dist/esm/auth/index.mjs",
"import": "{ updatePassword }",
"limit": "9.19 kB"
"limit": "9.14 kB"
},
{
"name": "[Auth] setUpTOTP (Cognito)",
Expand All @@ -420,7 +420,7 @@
"name": "[Auth] updateUserAttributes (Cognito)",
"path": "./dist/esm/auth/index.mjs",
"import": "{ updateUserAttributes }",
"limit": "8.46 kB"
"limit": "8.41 kB"
},
{
"name": "[Auth] getCurrentUser (Cognito)",
Expand All @@ -432,7 +432,7 @@
"name": "[Auth] confirmUserAttribute (Cognito)",
"path": "./dist/esm/auth/index.mjs",
"import": "{ confirmUserAttribute }",
"limit": "9.19 kB"
"limit": "9.15 kB"
},
{
"name": "[Auth] signInWithRedirect (Cognito)",
Expand Down
50 changes: 0 additions & 50 deletions packages/core/__tests__/utils/deDupeAsyncRequests.test.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/src/libraryUtils.ts
Expand Up @@ -17,7 +17,6 @@ export {
retry,
urlSafeDecode,
urlSafeEncode,
deDupeAsyncFunction,
} from './utils';
export { parseAWSExports } from './parseAWSExports';
export { LegacyConfig } from './singleton/types';
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/singleton/apis/fetchAuthSession.ts
Expand Up @@ -3,8 +3,10 @@

import { fetchAuthSession as fetchAuthSessionInternal } from './internal/fetchAuthSession';
import { Amplify } from '../Amplify';
import { FetchAuthSessionOptions } from '../Auth/types';
import { AuthSession, FetchAuthSessionOptions } from '../Auth/types';

export const fetchAuthSession = (options?: FetchAuthSessionOptions) => {
export const fetchAuthSession = (
options?: FetchAuthSessionOptions
): Promise<AuthSession> => {
return fetchAuthSessionInternal(Amplify, options);
};
38 changes: 0 additions & 38 deletions packages/core/src/utils/deDupeAsyncFunction.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/src/utils/index.ts
Expand Up @@ -15,4 +15,3 @@ export {
export { urlSafeDecode } from './urlSafeDecode';
export { urlSafeEncode } from './urlSafeEncode';
export { deepFreeze } from './deepFreeze';
export { deDupeAsyncFunction } from './deDupeAsyncFunction';
2 changes: 1 addition & 1 deletion packages/datastore/src/sync/processors/subscription.ts
Expand Up @@ -279,7 +279,7 @@ class SubscriptionProcessor {

try {
// retrieving current token info from Cognito UserPools
const session = await fetchAuthSession();
const session = await await fetchAuthSession();
oidcTokenPayload = session.tokens?.idToken?.payload;
} catch (err) {
// best effort to get jwt from Cognito
Expand Down