Headless Chrome displays old Google sign-in when signing in with OpenID/OAuth

2,310 views
Skip to first unread message

dmitry....@teamdev.com

unread,
Jul 5, 2017, 3:58:29 PM7/5/17
to headless-dev
Hello,

We are using headless Chrome for testing our application that has a Google sign-in feature (with Firebase Authentication). What we have faced is that when authenticating with Google from headless Chrome, we get an old Google sign-in page:


...and when using a regular "headed" mode of Chrome, we get a new Google sign-in:


This can be reproduced when logging in with Google to Stack Overflow or GitLab. Interestingly, the accounts.google.com page displays a new Google sign-in in both headless and "headed" modes.

According to the new Google sign-in description page, the old sign-in page might appear in an "older version of a browser" or when JavaScript is turned off, which is neither the case here.
What is the reason of this difference? Is it an expected behavior triggered by some factors or a bug?

I'm using Chrome 59.0.3071.109 on Ubuntu 17.04.

Thanks,
Dmitry

Eric Seckler

unread,
Jul 6, 2017, 2:27:15 AM7/6/17
to dmitry....@teamdev.com, headless-dev

Could be related to the user agent that is sent in headless mode. You could try overriding it via the --user-agent flag.


--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/07d6133d-8ca1-45cd-97c8-401629faa6c7%40chromium.org.

dmitry....@teamdev.com

unread,
Jul 6, 2017, 6:46:38 AM7/6/17
to headless-dev, dmitry....@teamdev.com
Yes, this was due to the user agent. Thanks!

andre...@gmail.com

unread,
Dec 21, 2017, 10:08:04 PM12/21/17
to headless-dev, dmitry....@teamdev.com
Could you share what value you used for the flag? Running into this exact issue...

hatim.far...@photobookworldwide.com

unread,
Apr 10, 2019, 5:56:50 AM4/10/19
to headless-dev, dmitry....@teamdev.com, andre...@gmail.com
Hi dmitry, would mind sharing the value for the --user-agentflag, or maybe how u declare it? Really need your help man ...

dmitry....@teamdev.com

unread,
Apr 10, 2019, 9:19:39 AM4/10/19
to headless-dev, dmitry....@teamdev.com, andre...@gmail.com, hatim.far...@photobookworldwide.com
Sorry, can't find the original code now... Not 100% sure, but from what I remember, it turned to be as simple as passing the value of the navigator.userAgent property, when evaluated in an ordinary "headed" mode. E.g., it returns "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" for my version of Chrome currently, but it obviously was slightly different for the version I used back then.

subhojit khara

unread,
Aug 13, 2020, 3:50:12 AM8/13/20
to headless-dev, dmitry....@teamdev.com, andre...@gmail.com, hatim.far...@photobookworldwide.com
Hi Hatim, Did you used the user agent told by dmitry, does it work?

Suraj Gupta

unread,
Sep 25, 2020, 11:49:09 AM9/25/20
to headless-dev, subhojit khara, dmitry....@teamdev.com, andre...@gmail.com, hatim.far...@photobookworldwide.com
Hello Guys,

Below user-agent worked for me!!

 options.addArguments("user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36");


To get your browser specific user agent go to https://www.whatismybrowser.com/detect/what-is-my-user-agent 


Thanks

as16...@stu.hemetusd.org

unread,
Sep 27, 2020, 3:14:46 PM9/27/20
to headless-dev, dmitry....@teamdev.com
Message has been deleted

Jerry Lee Daniel

unread,
Nov 19, 2023, 5:03:35 PM11/19/23
to headless-dev, as16...@stu.hemetusd.org, dmitry....@teamdev.com

Loans, Project and Digital Investment financing available up to $500m.
Have a Business Plan, Fundable Project and Redeemable Collateral.

Whatsapp: +44 7405 896213
Reply all
Reply to author
Forward
0 new messages