Generate API keys
Before usingasc, you need to create an API key in App Store Connect:
Open App Store Connect
Create a new API key
- Click the + button to create a new key
- Assign a name (e.g., “CI/CD Pipeline” or “Local Development”)
- Select an access level:
- Admin: Full read/write access (use with caution)
- Developer: Read/write for apps, builds, TestFlight (recommended)
- App Manager: Limited to app management tasks
- Customer Support: Read-only for reviews and feedback
Download the private key
- Click Download API Key to get the
.p8file - Save it securely - you can only download it once
- Recommended location:
~/.asc/AuthKey_ABC123.p8
Store credentials
asc provides multiple ways to store and manage your API credentials.
Option 1: System keychain (recommended)
Store credentials securely in your system keychain (macOS Keychain, Windows Credential Manager, or Linux Secret Service):When using keychain storage, the CLI stores the encrypted key material so commands work even if the original
.p8 file is removed.Verify storage
Option 2: Config file
Store credentials in a JSON config file with restricted permissions:~/.asc/config.json with 0600 permissions.
Local (per-project) config
For project-specific credentials:./.asc/config.json in your current directory.
Add
.asc/config.json to .gitignore to avoid committing secrets.Option 3: Environment variables
For CI/CD pipelines or ephemeral environments:Manage multiple profiles
Switch between different API keys for multiple apps or teams:Add a second profile
List all profiles
Switch default profile
Use a specific profile
Override the default with--profile:
Credential resolution order
asc resolves credentials in this order:
- Explicit profile flag:
--profile "ProfileName" - Environment variables:
ASC_KEY_ID,ASC_ISSUER_ID,ASC_PRIVATE_KEY_PATH(orASC_PRIVATE_KEY,ASC_PRIVATE_KEY_B64) - Default profile: The profile marked as default in keychain/config
- Single stored credential: If only one profile exists, use it automatically
Use
--strict-auth or ASC_STRICT_AUTH=true to fail when credentials are resolved from multiple sources (helps catch mixed-source errors).Validate credentials
Test your credentials with a lightweight API request:Diagnose issues
Run the authentication doctor to check for configuration problems:Auto-fix issues
- Migrate legacy keychain entries
- Fix file permissions on
.p8files - Resolve conflicting credential sources
Remove credentials
Remove a specific profile
Remove all credentials
Security best practices
Protect private keys
Protect private keys
- Store
.p8files with0600permissions:chmod 600 AuthKey_*.p8 - Never commit keys to version control
- Rotate keys periodically (every 6-12 months)
- Revoke keys immediately if compromised
Use appropriate permissions
Use appropriate permissions
- Developer role: Sufficient for most automation tasks
- Admin role: Only for account-wide operations
- App Manager: For metadata-only workflows
- Create separate keys for different environments (dev, staging, production)
CI/CD secrets management
CI/CD secrets management
- Store keys in secret management systems (GitHub Secrets, GitLab CI Variables, HashiCorp Vault)
- Use environment variables, not config files
- Prefer
ASC_PRIVATE_KEY_B64for base64-encoded keys - Never log private key content in CI output
Audit and monitoring
Audit and monitoring
- Review API key activity in App Store Connect
- Use descriptive key names (“CI Pipeline” not “Key 1”)
- Revoke unused keys
- Enable
--strict-authto catch credential conflicts
Environment variables reference
| Variable | Purpose | Example |
|---|---|---|
ASC_KEY_ID | API Key ID | ABC123DEFG |
ASC_ISSUER_ID | Issuer ID (UUID) | 12345678-abcd-1234-abcd-123456789012 |
ASC_PRIVATE_KEY_PATH | Path to .p8 file | /path/to/AuthKey.p8 |
ASC_PRIVATE_KEY | Raw PEM content | -----BEGIN PRIVATE KEY-----\n... |
ASC_PRIVATE_KEY_B64 | Base64-encoded PEM | LS0tLS1CRUdJTi... |
ASC_PROFILE | Named profile to use | MyApp |
ASC_BYPASS_KEYCHAIN | Skip keychain, use config/env | 1, true, yes, on |
ASC_STRICT_AUTH | Fail on mixed sources | 1, true, yes, on |
Troubleshooting
Keychain access denied
If you see “keychain access denied” errors:- Check macOS keychain settings: Keychain Access → Preferences → Reset My Default Keychain
- Bypass keychain temporarily:
Invalid private key format
Ensure your.p8 file:
- Starts with
-----BEGIN PRIVATE KEY----- - Is ECDSA format (App Store Connect uses P-256/ES256)
- Has correct permissions:
chmod 600 AuthKey_*.p8
JWT generation failed
Verify all three credentials are correct:- Key ID and Issuer ID don’t match the
.p8file - Private key file is corrupted or incomplete
Next steps
Quickstart
Run your first commands with asc
CI/CD integration
Use asc in GitHub Actions, GitLab CI, and more
