AWS Cognito
With this integration you can engage customers with flexible authentication, manage B2B identities, secure machine-to-machine authentication or get role-based access to AWS resources.
Official Websitehttps://aws.amazon.com/es/cognito/
TagsawssecuritySaas
JavaScript
Python
Version3.385.0
Documentationhttps://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cognito-idp.html
Pypi packagehttps://pypi.org/project/boto3/
Version1.26.79
Source Codehttps://github.com/boto/boto3
Credential configuration
To fill the form params you need the Access key id
and the Secret access key
of the Programatic access
user you want to use. This user needs the permissions
to have access to Lambda to work properly. If you need to create the user,
you can see how to do it here.
In the extra options field you can pass any of the params you can find here.
Here you have an example of a filled credential configuration form in YepCode:

AWS Lambda snippets available in YepCode editor
note
The title is the triggering text for YepCode to autocomplete the script
JavaScript
Python
Integration
New integration from credential
const ${1:awsCognitoClient} = yepcode.integration.awsCognito("${2:credential-slug}");
New integration from plain authentication data
const { CognitoIdentityProviderClient } = require("@aws-sdk/client-cognito-identity-provider");
const ${1:awsCognitoClient} = new CognitoIdentityProviderClient({
credentials: {
accessKeyId: "${2:accessKeyId}",
secretAccessKey: "${3:secretAccessKey}",
},
});
Create Identify Provider
Create identify provider
const { CreateIdentityProviderCommand } = require('@aws-sdk/client-cognito-identity-provider)
const input = {
UserPoolId: ${2:userPoolId},
ProviderName: ${3:providerName},
ProviderType: ${4:providerType},
ProviderDetails: {
${5:keys}: ${6:providerDetails},
}
};
const command = new CreateIdentityProviderCommand(input);
const response = await ${1:awsCognitoClient}.send(command);
Create User Pool
Create user pool
const { CreateUserPoolCommand } = require("@aws-sdk/client-cognito-identity-provider");
const input = {
PoolName: ${2:poolName}
LambdaConfig: {
CustomSMSSender: {
LambdaVersion: ${3:lambdaVersion},
LambdaArn: ${4:lambdaArn},
},
CustomEmailSender: {
LambdaVersion: ${3:lambdaVersion},
LambdaArn: ${4:lambdaArn},
},
},
SmsConfiguration: {
SnsCallerArn: ${5:snsCallerArn},
},
UsernameConfiguration: {
CaseSensitive: ${6:caseSensitive},
},
AccountRecoverySetting: {
RecoveryMechanisms: [
{
Priority: Number(${7:recoveryMechanismsPriority}),
Name: ${8:recoveryMechanismsName},
},
],
}
};
const command = new CreateUserPoolCommand(input);
const response = await ${1:awsCognitoClient}.send(command);
List identity providers
List identify providers
const { ListIdentityProvidersCommand } = require("@aws-sdk/client-cognito-identity-provider");
const input = {
UserPoolId: ${2:userPoolId}
};
const command = new ListIdentityProvidersCommand(input);
const response = await ${1:awsCognitoClient}.send(command);
for(const provider of response.Providers) {
console.log(provider)
}
Integration
New integration from credential
${1:aws_cognito_client} = yepcode.integration.aws_cognito("${2:credential-slug}")
New integration from plain authentication data
import boto3
session = boto3.Session(
aws_access_key_id="${2:accessKeyId}",
aws_secret_access_key="${3:secretAccessKey}",
region_name="${4:region}"
)
${1:aws_cognito_client} = session.client("cognito")
Create Identify Provider
Create identify provider
response = ${1:aws_cognito_client}.create_identity_provider(
UserPoolId = ${2:userPoolId},
ProviderName = ${3:providerName},
ProviderType = ${4:providerType},
ProviderDetails = {
${5:keys}: ${6:providerDetails},
}
)
Create User Pool
Create user pool
response = ${1:aws_cognito_client}.create_user_pool(
PoolName = ${2:poolName}
LambdaConfig = {
CustomSMSSender: {
'LambdaVersion': ${3:lambdaVersion},
'LambdaArn': ${4:lambdaArn},
},
CustomEmailSender: {
'LambdaVersion': ${3:lambdaVersion},
'LambdaArn': ${4:lambdaArn},
}
},
SmsConfiguration = {
'SnsCallerArn': ${5:snsCallerArn}
},
UsernameConfiguration = {
'CaseSensitive': ${6:caseSensitive}
},
AccountRecoverySetting: {
'RecoveryMechanisms': [
{
'Priority': ${7:recoveryMechanismsPriority},
'Name': ${8:recoveryMechanismsName},
},
]
}
)
List identity providers
List identity providers
response = ${1:aws_cognito_client}.list_identity_providers(
UserPoolId=${2:userPoolId}
)
for provider in response['Providers']:
print(provider)