Skip to main content

snippets_py

Integration

New integration from credential
aws_cognito_client = yepcode.integration.aws_cognito("credential-slug")
New integration from plain authentication data
import boto3

session = boto3.Session(
aws_access_key_id="accessKeyId",
aws_secret_access_key="secretAccessKey",
region_name="region"
)

aws_cognito_client = session.client("cognito")

Create Identify Provider

Create identify provider
response = aws_cognito_client.create_identity_provider(
UserPoolId = userPoolId,
ProviderName = providerName,
ProviderType = providerType,
ProviderDetails = {
keys: providerDetails,
}
)

Create User Pool

Create user pool
response = aws_cognito_client.create_user_pool(
PoolName = poolName
LambdaConfig = {
CustomSMSSender: {
'LambdaVersion': lambdaVersion,
'LambdaArn': lambdaArn,
},
CustomEmailSender: {
'LambdaVersion': lambdaVersion,
'LambdaArn': lambdaArn,
}
},
SmsConfiguration = {
'SnsCallerArn': snsCallerArn
},
UsernameConfiguration = {
'CaseSensitive': caseSensitive
},
AccountRecoverySetting: {
'RecoveryMechanisms': [
{
'Priority': recoveryMechanismsPriority,
'Name': recoveryMechanismsName,
},
]
}
)

List Identity Providers

List identity providers
response = aws_cognito_client.list_identity_providers(
UserPoolId=userPoolId
)

for provider in response['Providers']:
print(provider)