umihico / docker-selenium-lambda

The simplest demo of chrome automation by python and selenium in AWS Lambda
MIT License
493 stars 118 forks source link

Any ideas on handling 2FA? #251

Open drjimmyjiang opened 1 month ago

drjimmyjiang commented 1 month ago

The website I need to interact with will be introducing mandatory 2FA. Are there any clever ways on handling 2FA? There is a feature to trust the computer you're logging on from for 30 days, but now sure how this would be relevant to running the selenium script on AWS. Any guidance would be much appreciated!

wigeria commented 3 weeks ago

This isn't really related to this project, but depending on how your particular site is handling that 30 day session (I'm assuming with cookies?), you could technically do a manual login once a month, store those cookies in S3, load those inside the Lambda function and plug those into Selenium on init.

There are other methods based on the type of 2FA as well. For example, if the 2FA is via SMS, you could look into getting a Twilio (or another service) number and receive the 2FA there, which could then fire a webhook to do put it somewhere the Lambda function could read from.