JBrowser Source Docs
You are reading the documentation for JBrowser 1.6.0. The newest release is 2.0.3. Go to the latest documentation

jbrowser.engine.signin

Generated from the source code of JBrowser 1.6.0.

jbrowser/engine/signin.py · 127 lines

Signing in to Google: the space presents Firefox while one of its pages is on the sign-in server.

Google refuses to sign in browsers it takes for web views embedded in other apps ("Couldn't sign you in. This browser or app may not be secure"). Sending a Firefox user agent to accounts.google.com only (services/privacy.py, since 1.5.1) is enough on most PCs. Where Google looks closer, it also sees the rest of the page still saying Chromium (navigator.userAgent, navigator.userAgentData and the Sec-CH-UA headers) and refuses anyway; switching DevTools' user agent to Firefox fixed it.

So while any page of a space (a card or a sign-in popup) is on Google's sign-in server, the space's profile presents Firefox everywhere a site can look (identity.apply_firefox), and a few seconds after the last one leaves it goes back to Chrome. The switch happens before the navigation is sent, so the sign-in page itself loads with the consistent identity.

Constants#

Name Value
SIGNIN_HOSTS ('accounts.google.com',)
RESTORE_DELAY_MS 4000
RENAVIGATE_GAP 30.0

SigninIdentity#

class SigninIdentity(QObject)source
SigninIdentity(restore: Callable[[QWebEngineProfile], None], parent: QObject | None=None)

Keeps track of which pages are on a sign-in server and switches their profiles' identity.

SigninIdentity.is_firefox#

is_firefox(profile: QWebEngineProfile) -> boolsource

SigninIdentity.watch#

watch(page: QWebEnginePage) -> Nonesource

SigninIdentity.before_navigation#

before_navigation(page: QWebEnginePage, url: QUrl, is_main: bool) -> boolsource

Called from acceptNavigationRequest (also for redirects), before the request is sent. Returns False when the navigation has to wait: Chromium can't change a page's identity from inside that callback, so the space switches to Firefox a moment later and then the page loads url again. Google never sees a request from the half-switched browser.

SigninIdentity.forget_profile#

forget_profile(profile: QWebEngineProfile) -> Nonesource

The profile is going away (its space was closed).

Functions#

is_signin_url#

is_signin_url(url: QUrl) -> boolsource