0

New to this. Is there a way to limit simultaneous logins for cognito using Aws Lambda Post-Authentication trigger?

Basically I want my app to only have 1 user account logged in at a time, if at any point the user logs into the account via another (new device) the app either stops them, or logs them out of previous sessions.

What would a function for this look like?

shadow_ace
  • 31
  • 3
  • see this thread: https://stackoverflow.com/questions/59635482/aws-cognito-best-practice-to-handle-same-user-with-same-email-address-signing – Chuck LaPress Jul 17 '21 at 21:54
  • @ChuckLaPress i dont think that thread helps. i looked it over and it shows for PreSignUp lambda hook. im looking for a hook for after login. user logs in one device A, then wihtout logging out, logs into Device B, (they should not be able to log into device B if Device A session is still active) – shadow_ace Jul 19 '21 at 01:11
  • Does this answer your question? [AWS Cognito User Pool without a password](https://stackoverflow.com/questions/45666794/aws-cognito-user-pool-without-a-password) – Aleksander Wons Jul 20 '21 at 17:10
  • no it doesn't help. let me clarify. I want to be able to use Post Authentication Lambda Trigger to figure out if a user is accessing their account from multiple devices and limit them from logging in on multiple devices. (https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-post-authentication.html) One of the use cases that amazon mentions it says it can do this (https://aws.amazon.com/blogs/mobile/tracking-and-remembering-devices-using-amazon-cognito-your-user-pools/) – shadow_ace Jul 21 '21 at 20:35
  • Something similar to this https://stackoverflow.com/questions/40516101/lambda-function-to-count-the-number-of-devices-linked-to-a-user – shadow_ace Jul 23 '21 at 04:21

0 Answers0