2020parser .add_argument ('--profile' , help = "AWS Credentials Profile Name (optional)" )
2121
2222def main ():
23- user_pool_id = ""
2423 apigateway_endpoint = ""
2524 apigateway_cognito_lambda = ""
2625
@@ -31,8 +30,8 @@ def main():
3130 "cognito_issuer" :"" ,
3231 "cognito_auth_endpoint" :"" ,
3332 "cognito_token_url" :"" ,
33+ "cognito_user_pool_id" :"" ,
3434 "cognito_client_id" :"" ,
35- "cognito_client_secret" :"" ,
3635 "cognito_auth_scope" :"" ,
3736 "healthlake_endpoint" :"" ,
3837 "openapi_spec_file" :args .openapi_spec_file
@@ -47,7 +46,6 @@ def main():
4746
4847 print (f"Getting output variables from Cloudformation stack name: { args .cfn_name } " )
4948 cfn_client = session .client ("cloudformation" , region_name = args .region )
50- cognito_client = session .client ("cognito-idp" , region_name = args .region )
5149
5250 next_token = "start"
5351 while next_token != "end" :
@@ -80,14 +78,12 @@ def main():
8078 env_vars ['cognito_token_url' ] = output ['OutputValue' ]
8179 elif output ['OutputKey' ] == 'APIClientId' :
8280 env_vars ['cognito_client_id' ] = output ['OutputValue' ]
83- elif output ['OutputKey' ] == 'ClientSecret' :
84- env_vars ['cognito_client_secret' ] = output ['OutputValue' ]
8581 elif output ['OutputKey' ] == 'oAuthScope' :
8682 env_vars ['cognito_auth_scope' ] = output ['OutputValue' ]
8783 elif output ['OutputKey' ] == 'HealthLakeEndpoint' :
8884 env_vars ['healthlake_endpoint' ] = output ['OutputValue' ]
8985 elif output ['OutputKey' ] == 'UserPoolId' :
90- user_pool_id = output ['OutputValue' ]
86+ env_vars [ 'cognito_user_pool_id' ] = output ['OutputValue' ]
9187 elif output ['OutputKey' ] == 'ApiUrl' :
9288 apigateway_endpoint = output ['OutputValue' ]
9389 elif output ['OutputKey' ] == 'APIGWCognitoLambdaName' :
@@ -105,13 +101,6 @@ def main():
105101 if 'issuer' in response_json :
106102 env_vars ['cognito_issuer' ] = response_json ['issuer' ]
107103
108- print (f"Getting Client Secret using UserPoolId: { user_pool_id } and ClientId: { env_vars ['cognito_client_id' ]} " )
109- response = cognito_client .describe_user_pool_client (
110- UserPoolId = user_pool_id ,
111- ClientId = env_vars ['cognito_client_id' ]
112- )
113- env_vars ['cognito_client_secret' ] = response ['UserPoolClient' ]['ClientSecret' ]
114-
115104 print (f"Creating .env file" )
116105 # Open the .env file in write mode
117106 with open (".env" , "w" ) as f :
0 commit comments