Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"For your protection, you can't sign in from this device." usando selenium web-drivers en GCP Compute Engine

I have automated tests of UI with Selenium, The first step is to enter a Google account (username and password, the account does not require anything else). These tests run well on my personal computer, but when I try to run them on a virtual machine in Compute Engine with chrome / firefox etc. After entering email and password, Google returns the following message:

"For your protection, you can't sign in from this device. Try again later, or sign in from another device."

Additional notes:

  • I have already tried several accounts; Gmail (personal / standard and with G Suite) and the same thing happens (Selenium + Compute Engine)

  • In Compute Engine machines I can enter traditionally / manually well,no problem. The problem arises when I run the script with Selenum (webdrive chrome and firefox).

  • The OS Centos 7 + xfce, selenium node js

  • UserAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36"

I attach the image, I appreciate any help.

Image link

like image 202
Oscar Oswaldo Ortiz Perez Avatar asked Aug 03 '19 12:08

Oscar Oswaldo Ortiz Perez


1 Answers

I'm not positive this will help, but I notice your user-agent looks unconventional, reporting Safari and WebKit on Linux.

I know in my Firefox on MacOS, I have an extension that spoofs my user-agent with strings that I know for sure are valid but don't match my actual setup, and I reliably get that same error trying to log into my Google account unless I turn that extension off. I believe Google may be using Javascript to do some fingerprinting, and then refusing to allow logins at all if the user-agent string doesn't match what it finds, and returns only that vague message that I "can't sign in from this device."

Maybe you could try setting your user-agent string to something more common or appropriate for your OS and browser.

like image 166
John Smith Avatar answered Oct 05 '22 14:10

John Smith



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!