File tree Expand file tree Collapse file tree
packages/amplify-provider-awscloudformation/src/aws-utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,21 +23,28 @@ import {
2323 ListUserPoolsRequest ,
2424} from '@aws-sdk/client-cognito-identity-provider' ;
2525import { ICognitoUserPoolService } from '@aws-amplify/amplify-util-import' ;
26- import { loadConfiguration } from '../configuration-manager' ;
26+ import { AwsSecrets , loadConfiguration } from '../configuration-manager' ;
2727import { fileLogger } from '../utils/aws-logger' ;
2828import { pagedAWSCall } from './paged-call' ;
2929const logger = fileLogger ( 'CognitoUserPoolService' ) ;
3030
3131export const createCognitoUserPoolService = async ( context : $TSContext , options : $TSAny ) : Promise < CognitoUserPoolService > => {
32- let credentials = { } ;
32+ let credentials : AwsSecrets = { } ;
3333
3434 try {
3535 credentials = await loadConfiguration ( context ) ;
3636 } catch ( e ) {
3737 // could not load credentials
3838 }
3939
40- const cognito = new CognitoIdentityProviderClient ( { ...credentials , ...options } ) ;
40+ const cognito = new CognitoIdentityProviderClient ( {
41+ ...options ,
42+ credentials : {
43+ accessKeyId : credentials . accessKeyId ,
44+ secretAccessKey : credentials . secretAccessKey ,
45+ } ,
46+ region : credentials . region ,
47+ } ) ;
4148
4249 return new CognitoUserPoolService ( cognito ) ;
4350} ;
Original file line number Diff line number Diff line change @@ -10,19 +10,26 @@ import {
1010 ListIdentityPoolsResponse ,
1111 ListIdentityPoolsInput ,
1212} from '@aws-sdk/client-cognito-identity' ;
13- import { loadConfiguration } from '../configuration-manager' ;
13+ import { AwsSecrets , loadConfiguration } from '../configuration-manager' ;
1414import { pagedAWSCall } from './paged-call' ;
1515
1616export const createIdentityPoolService = async ( context : $TSContext , options : $TSAny ) : Promise < IdentityPoolService > => {
17- let credentials = { } ;
17+ let credentials : AwsSecrets = { } ;
1818
1919 try {
2020 credentials = await loadConfiguration ( context ) ;
2121 } catch ( e ) {
2222 // could not load credentials
2323 }
2424
25- const cognitoIdentity = new CognitoIdentityClient ( { ...credentials , ...options } ) ;
25+ const cognitoIdentity = new CognitoIdentityClient ( {
26+ ...options ,
27+ credentials : {
28+ accessKeyId : credentials . accessKeyId ,
29+ secretAccessKey : credentials . secretAccessKey ,
30+ } ,
31+ region : credentials . region ,
32+ } ) ;
2633
2734 return new IdentityPoolService ( cognitoIdentity ) ;
2835} ;
Original file line number Diff line number Diff line change @@ -24,8 +24,12 @@ export class CognitoUserPoolClientProvider {
2424
2525 constructor ( creds : AwsSecrets , options = { } ) {
2626 const clientConfig : CognitoIdentityProviderClientConfig = {
27- ...creds ,
2827 ...options ,
28+ credentials : {
29+ accessKeyId : creds . accessKeyId ,
30+ secretAccessKey : creds . secretAccessKey ,
31+ } ,
32+ region : creds . region ,
2933 requestHandler : new NodeHttpHandler ( {
3034 httpAgent : proxyAgent ( ) ,
3135 httpsAgent : proxyAgent ( ) ,
Original file line number Diff line number Diff line change @@ -23,8 +23,12 @@ export class LocationService {
2323
2424 private constructor ( cred : AwsSecrets , options = { } ) {
2525 this . client = new LocationClient ( {
26- ...cred ,
2726 ...options ,
27+ credentials : {
28+ accessKeyId : cred . accessKeyId ,
29+ secretAccessKey : cred . secretAccessKey ,
30+ } ,
31+ region : cred . region ,
2832 requestHandler : new NodeHttpHandler ( {
2933 httpAgent : proxyAgent ( ) ,
3034 httpsAgent : proxyAgent ( ) ,
You can’t perform that action at this time.
0 commit comments