File tree 2 files changed +15
-5
lines changed
awsClients/cognitoIdentity
2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 1
1
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
+ import { Amplify } from '@aws-amplify/core' ;
5
+
4
6
import {
5
7
Endpoint ,
6
8
EndpointResolverOptions ,
@@ -29,11 +31,17 @@ const SERVICE_NAME = 'cognito-identity';
29
31
/**
30
32
* The endpoint resolver function that returns the endpoint URL for a given region.
31
33
*/
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
+ } ;
37
45
38
46
/**
39
47
* A Cognito Identity-specific middleware that disables caching for all requests.
Original file line number Diff line number Diff line change @@ -135,12 +135,14 @@ export interface AuthIdentityPoolConfig {
135
135
136
136
export interface CognitoIdentityPoolConfig {
137
137
identityPoolId : string ;
138
+ identityPoolEndpoint ?: string ;
138
139
allowGuestAccess ?: boolean ;
139
140
}
140
141
141
142
export interface AuthUserPoolConfig {
142
143
Cognito : CognitoUserPoolConfig & {
143
144
identityPoolId ?: never ;
145
+ identityPoolEndpoint ?: never ;
144
146
allowGuestAccess ?: never ;
145
147
} ;
146
148
}
You can’t perform that action at this time.
0 commit comments