This document outlines authentication methods, credential storage, and error handling for developers and AI agents using LinkedIn CLI.
LinkedIn CLI interfaces with LinkedIn data via Apify actors. Authentication requires an Apify API token. Tokens can be stored in the host operating system's native keychain or supplied directly via environment variables and standard input.
linkedin login)The recommended flow for local developer machines:
linkedin login [account_name]
1. The CLI launches your system browser to https://console.apify.com/account/integrations.
2. You copy or generate your personal Apify token.
3. Paste the token into the CLI prompt (input characters are masked).
4. The CLI validates the key with a live request to GET /v2/users/me.
5. Upon confirmation, the key is securely saved to the native OS keyring under the account name (defaults to default).
For headless CI/CD environments or autonomous agents:
printf %s "$APIFY_TOKEN" | linkedin login [account_name] --api-key-stdin
Or pass the token directly as a flag:
linkedin login [account_name] --api-key "$APIFY_TOKEN"
# List accounts and check status against Apify
linkedin accounts list --check
# Test a specific account
linkedin accounts test work