restrict specific users using lambda function for registration and signin

0

i want to restrict a specific domain @abc.com so that other than @abc.com no one can login to my application can you please help, i have created cognito domain as login but now the issue is everyone can login using gmail, yahoo or any other domain.

akif
asked a year ago369 views
2 Answers
0

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.

profile picture
EXPERT
answered a year ago
profile picture
EXPERT
reviewed a year ago
0

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

akif
answered a year ago
  • Sorry, I am not aware of the existence of the cognito-user-pools.json file. Can you provide more information please?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions