Skip to content

Commit 3016c58

Browse files
committed
fix linter
1 parent b6de5f9 commit 3016c58

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

packages/core/src/awsClients/cognitoIdentity/base.ts

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
import { Amplify } from '@aws-amplify/core';
5+
46
import {
57
Endpoint,
68
EndpointResolverOptions,
@@ -29,11 +31,17 @@ const SERVICE_NAME = 'cognito-identity';
2931
/**
3032
* The endpoint resolver function that returns the endpoint URL for a given region.
3133
*/
32-
const endpointResolver = ({ region }: EndpointResolverOptions) => ({
33-
url: new AmplifyUrl(
34-
`https://cognito-identity.${region}.${getDnsSuffix(region)}`,
35-
),
36-
});
34+
const endpointResolver = ({ region }: EndpointResolverOptions) => {
35+
const authConfig = Amplify.getConfig().Auth?.Cognito;
36+
const customURL = authConfig?.userPoolEndpoint;
37+
const defaultURL = new AmplifyUrl(
38+
`https://${SERVICE_NAME}.${region}.${getDnsSuffix(region)}`,
39+
);
40+
41+
return {
42+
url: customURL ? new AmplifyUrl(customURL) : defaultURL,
43+
};
44+
};
3745

3846
/**
3947
* A Cognito Identity-specific middleware that disables caching for all requests.

packages/core/src/singleton/Auth/types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,14 @@ export interface AuthIdentityPoolConfig {
135135

136136
export interface CognitoIdentityPoolConfig {
137137
identityPoolId: string;
138+
identityPoolEndpoint?: string;
138139
allowGuestAccess?: boolean;
139140
}
140141

141142
export interface AuthUserPoolConfig {
142143
Cognito: CognitoUserPoolConfig & {
143144
identityPoolId?: never;
145+
identityPoolEndpoint?: never;
144146
allowGuestAccess?: never;
145147
};
146148
}

0 commit comments

Comments
 (0)