This program is used to produce the secret TEST_ACCOUNTS used by the chatgpt-scraper. TEST_ACCOUNTS is a dictionary of the form:
{
	"test@company.com": {
		"provider": "basic",
		"password": "some password",
		"secret": {
			"google": "some secret",
			"chatgpt": "some secret"
		}
	}
}The secret is obtained from the totp.Account URL which comes from the QR code generated by w3id when setting up 2FA.
For example: otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
The secret is the value of the secret query parameter.
E.g., JBSWY3DPEHPK3PXP in the above example.
Configuration is done via environment variables. Please see the .env.example file for a list of all available variables.
- Python 3.11+
- Poetry
poetry installTo use the accounts_serializer.py script, you can pass the emails, passwords, providers, and secrets as arguments. Here's an example:
poetry run python accounts_serializer.py \
    --emails test@company.com user@anothercompany.com \
    --passwords password123 userpassword456 \
    --providers basic basic \
    --secrets google:google-secret-abc chatgpt:chatgpt-secret-xyz github:github-secret-123 aws:aws-secret-789Running the above command will produce a JSON structure like the following:
{
    "test@company.com": {
        "provider": "basic",
        "password": "password123",
        "secret": {
            "google": "google-secret-abc",
            "chatgpt": "chatgpt-secret-xyz"
        }
    },
    "user@anothercompany.com": {
        "provider": "basic",
        "password": "userpassword456",
        "secret": {
            "github": "github-secret-123",
            "aws": "aws-secret-789"
        }
    }
}This JSON structure is then base64 encoded to be used as the TEST_ACCOUNTS environment variable.
You can also build and run the script using Docker:
docker build -t accounts_serializer .
docker run --rm --env-file .env accounts_serializer --help
docker run --rm --env-file .env accounts_serializer \
    --emails test@company.com user@anothercompany.com \
    --passwords password123 userpassword456 \
    --providers basic basic \
    --secrets google:google-secret-abc chatgpt:chatgpt-secret-xyz github:github-secret-123 aws:aws-secret-789This will allow you to generate the TEST_ACCOUNTS environment variable in a consistent and reproducible way.