Skip to main content
You operate several accounts on the same sites, such as an agency that runs its clients’ accounts with their permission, or a team that shares test accounts. Each account should sign in from the same browser every time. This walkthrough keeps a registry of accounts, gives each its own user data directory, persona, region and proxy, and checks that each account’s machine stays the same from one launch to the next. Follow each site’s terms for the accounts you run on it.

What Apostate changes

launch_persistent_context(DIR) keeps an account’s cookies and logins in a user data directory, the directory where Chromium keeps its storage. The first launch on a directory also stores a seed in DIR/apostate/identity, and every later launch presents the machine that seed selects. A site that remembers devices sees the same one at each sign-in. Each new directory draws its own seed, so two accounts do not present the same machine. Seeds and identity covers the identity file.

Set up

apostate fonts install windows is for Linux and macOS hosts (Fonts). The folder holds accounts.json, the registry, and accounts.py, which lists, opens, checks and backs up the accounts in it.

The registry

  • user_data_dir is relative to the registry file.
  • The script passes persona as fingerprint_platform on every launch. The identity file does not record the persona, so the registry does.
  • locale and timezone fix the account’s region, so it is the same on every launch whatever a GeoIP lookup would answer.
  • proxy_env names the environment variable that holds the account’s proxy URL, so the credential stays out of the file. null launches without a proxy.

Open an account

open launches a browser on the account’s user data directory, reads the machine from a page, and compares it with the machine recorded at the last launch:
READ collects the User-Agent, platform, cores, memory, screen, WebGL renderer, languages and timezone.

Run it

List the accounts. No user data directory exists yet:
Open an account twice:
The first launch drew seed 947bfbe8d30a... and stored it in the user data directory. The second launch read it back and presented the same machine. --url opens a page other than the default https://example.com. An account with a proxy variable does not open until you set the variable:

Check the registry

check fails when two accounts share a directory or when two directories hold the same seed. Two directories hold the same seed when you copy one account’s directory to start another:
The same command after a copy of profiles/qa-shared-login to profiles/client-b-store:
open and backup refuse to run while check reports a problem.

Back up an account

backup refuses while a browser has the directory open, because Chromium is still writing to it. To restore, unzip the archive into the account’s own directory. The restored directory presents the same machine, with the cookies from the time of the backup.

Rules for each account

  • One directory per account. Two accounts in one directory share cookies and a machine, and a site can link them. Never copy one account’s directory to start another, because the copy carries the same identity file. Choose seeds has the same rule for seeds.
  • One browser per directory at a time. A second launch on a directory that a browser has open fails with a LaunchError that says Failed to create a ProcessSingleton for your profile directory.
  • A proxy per account. Give each account one sticky exit in its registry region, and keep the proxy URL in the account’s variable. With locale and timezone set, the package skips its GeoIP lookup, so the registry values have to match the exit. Proxies covers sticky sessions.
  • Backups hold logins. A backup holds the account’s cookies. Store backups with the same care as the account’s password.
  • Updates. A release that changes the catalogue tables can change part of a machine. open compares each launch with the last one and names what changed. Pin the package version and read the changelog before you upgrade. Updates and catalogue changes covers what can move.
  • Working in the window. open runs headless. To sign in by hand, pass headless=False to launch_persistent_context() on a computer with a display.