- Newest
- Most votes
- Most comments
Hi,
You can configure a Pre authentication Lambda trigger on Cognito to perform a custom validation and accept or deny the sign-in request.
On the other hand, if you want to limit the domain with which users can register in your application, you should use the Pre sign-up Lambda trigger, which allows performing a custom validation to accept or deny the registration request.
Using a custom domain: If you have a custom domain configured for your user pool, you can add a list of allowed domains to the AllowedDomains attribute in the cognito-user-pools.json file. For example, the following code would allow users to sign in only if their email addresses end in @example.com or @mycompany.com:
"AllowedDomains": [ "example.com", "mycompany.com" ]
can you please help me find cognito-user-pools.json file, so that i can modify
Sorry, I am not aware of the existence of the cognito-user-pools.json file. Can you provide more information please?
Relevant content
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 2 years ago
this document is not clear can you please write me lambda function code and test code i am assigning lambda t in userpool properties in cognito
Both the Pre authentication and Pre sign-up Lambda trigger documentation have examples in Node and Python. Take a look please.
Additionally, you can also find examples that fit your use case in the following StackOverflow posts: "AWS Cognito: Restrict users to a single domain" and "Restrict to two specific domains @ Cognito with google login".