I'm made a cognito passwordless flow and i create userPool with this SAM template:
UserPool:
Type: "AWS::Cognito::UserPool"
Properties:
UserPoolName: !Ref UserPoolName
Schema:
- Name: phone_number
AttributeDataType: String
Mutable: true
- Name: email
AttributeDataType: String
Mutable: true
Policies:
PasswordPolicy:
MinimumLength: 6
RequireLowercase: false
RequireNumbers: false
RequireSymbols: false
RequireUppercase: false
AliasAttributes:
- email
- phone_number
MfaConfiguration: "OFF"
UserPoolClient:
Type: "AWS::Cognito::UserPoolClient"
Properties:
ClientName: sms-auth-client
GenerateSecret: false
UserPoolId: !Ref UserPool
ExplicitAuthFlows:
- CUSTOM_AUTH_FLOW_ONLY
Here, the User can use a email or phone_number to sign in, both of them are aliases.
But, Is there a way to identify which alias the User uses on sign in inside create-auth-lambda trigger?
Anyone can help?
Thats the answer: https://dev.to/duarten/passwordless-authentication-with-cognito-13c
Its a bit confused flow but it works fine.