asc-auth
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseasc auth — Multi-Account Authentication
asc auth — 多账户认证
Manages App Store Connect API key credentials in . Supports multiple named accounts with an active account that all commands use automatically.
~/.asc/credentials.jsonasc管理中的App Store Connect API密钥凭据。支持多个命名账户,且所有命令会自动使用一个活跃账户。
~/.asc/credentials.jsonascCommands
命令
login — save an account
login — 保存账户
bash
asc auth login \
--key-id <KEY_ID> \
--issuer-id <ISSUER_ID> \
--private-key-path ~/.asc/AuthKey_KEYID.p8 \
[--name <alias>] # optional; defaults to "default"
[--vendor-number <number>] # optional; for sales/finance reports- must not contain spaces (use hyphens or underscores, e.g.
--name)work-org - If no is given, saves under
--name"default" - The saved account is automatically set as active
- Saving to an existing name updates it (safe overwrite)
- Use instead of
--private-keyto pass raw PEM content--private-key-path - is optional; saved with credentials for auto-resolution by report commands
--vendor-number
Output — JSON:
AuthStatusjson
{
"data": [{
"affordances": {
"check": "asc auth check",
"list": "asc auth list",
"login": "asc auth login --key-id <id> --issuer-id <id> --private-key-path <path>",
"logout": "asc auth logout"
},
"issuerID": "abc-def-456",
"keyID": "KEYID123",
"name": "work",
"source": "file"
}]
}bash
asc auth login \
--key-id <KEY_ID> \
--issuer-id <ISSUER_ID> \
--private-key-path ~/.asc/AuthKey_KEYID.p8 \
[--name <alias>] # 可选;默认值为"default"
[--vendor-number <number>] # 可选;用于销售/财务报告- 不得包含空格(使用连字符或下划线,例如
--name)work-org - 如果未指定,则保存到
--name账户"default" - 保存的账户会自动设为活跃账户
- 保存到现有名称会更新该账户(安全覆盖)
- 使用替代
--private-key以传递原始PEM内容--private-key-path - 为可选参数;会与凭据一起保存,供报告命令自动解析
--vendor-number
输出 — JSON:
AuthStatusjson
{
"data": [{
"affordances": {
"check": "asc auth check",
"list": "asc auth list",
"login": "asc auth login --key-id <id> --issuer-id <id> --private-key-path <path>",
"logout": "asc auth logout"
},
"issuerID": "abc-def-456",
"keyID": "KEYID123",
"name": "work",
"source": "file"
}]
}list — show all saved accounts
list — 显示所有已保存账户
bash
asc auth list [--pretty] [--output table]- Active account:
"isActive": true - Inactive accounts have a affordance to switch
"use"
Output — array of :
ConnectAccountjson
{
"data": [
{
"affordances": { "logout": "asc auth logout --name personal", "use": "asc auth use personal" },
"isActive": false, "issuerID": "...", "keyID": "KEYID1", "name": "personal"
},
{
"affordances": { "logout": "asc auth logout --name work" },
"isActive": true, "issuerID": "...", "keyID": "KEYID2", "name": "work"
}
]
}bash
asc auth list [--pretty] [--output table]- 活跃账户:
"isActive": true - 非活跃账户会有一个操作选项用于切换
"use"
输出 — 数组:
ConnectAccountjson
{
"data": [
{
"affordances": { "logout": "asc auth logout --name personal", "use": "asc auth use personal" },
"isActive": false, "issuerID": "...", "keyID": "KEYID1", "name": "personal"
},
{
"affordances": { "logout": "asc auth logout --name work" },
"isActive": true, "issuerID": "...", "keyID": "KEYID2", "name": "work"
}
]
}use — switch active account
use — 切换活跃账户
bash
asc auth use <name>bash
asc auth use <name>→ Switched to account "work"
→ 已切换到账户"work"
Throws `accountNotFound` if `<name>` doesn't exist. Run `asc auth list` first to see valid names.
如果`<name>`不存在,会抛出`accountNotFound`错误。请先运行`asc auth list`查看有效账户名称。logout — remove an account
logout — 移除账户
bash
asc auth logout # removes the active account
asc auth logout --name work # removes a specific accountbash
asc auth logout # 移除活跃账户
asc auth logout --name work # 移除指定账户→ Logged out successfully
→ 登出成功
undefinedundefinedupdate — modify an existing account
update — 修改现有账户
bash
asc auth update [--name <alias>] --vendor-number <number>- Updates the named account (or active account if is omitted)
--name - Currently supports — the vendor number used by
--vendor-numberandsales-reportscommandsfinance-reports - Loads existing credentials, merges the update, and saves back
- Throws if the account doesn't exist
accountNotFound
Output — JSON (includes ):
AuthStatusvendorNumberjson
{
"data": [{
"affordances": { "check": "asc auth check", "list": "asc auth list", ... },
"issuerID": "abc-def-456",
"keyID": "KEYID123",
"name": "work",
"source": "file",
"vendorNumber": "88012345"
}]
}bash
asc auth update [--name <alias>] --vendor-number <number>- 更新指定账户(如果省略则更新活跃账户)
--name - 当前支持参数 — 供
--vendor-number和sales-reports命令使用的供应商编号finance-reports - 加载现有凭据,合并更新内容后重新保存
- 如果账户不存在,会抛出错误
accountNotFound
输出 — 包含的 JSON:
vendorNumberAuthStatusjson
{
"data": [{
"affordances": { "check": "asc auth check", "list": "asc auth list", ... },
"issuerID": "abc-def-456",
"keyID": "KEYID123",
"name": "work",
"source": "file",
"vendorNumber": "88012345"
}]
}check — verify active credentials
check — 验证活跃凭据
bash
asc auth check [--pretty] [--output table]Shows active account name + source ( or ). Shows if saved. No field for environment credentials.
"file""environment"vendorNumbernamebash
asc auth check [--pretty] [--output table]显示活跃账户名称及来源(或)。如果已保存,会显示。环境凭据无字段。
"file""environment"vendorNumbernameCredential Resolution Order
凭据解析顺序
All commands resolve credentials in this order:
asc- Active account in (set by
~/.asc/credentials.json/auth login)auth use - Environment variables: ,
ASC_KEY_ID,ASC_ISSUER_ID/ASC_PRIVATE_KEY_PATH/ASC_PRIVATE_KEY_B64ASC_PRIVATE_KEY
所有命令按以下顺序解析凭据:
asc- 中的活跃账户(通过
~/.asc/credentials.json/auth login设置)auth use - 环境变量:、
ASC_KEY_ID、ASC_ISSUER_ID/ASC_PRIVATE_KEY_PATH/ASC_PRIVATE_KEY_B64ASC_PRIVATE_KEY
Credentials File Format
凭据文件格式
json
{
"accounts": {
"personal": { "issuerID": "...", "keyID": "KEYID1", "privateKeyPEM": "..." },
"work": { "issuerID": "...", "keyID": "KEYID2", "privateKeyPEM": "...", "vendorNumber": "88012345" }
},
"active": "work"
}The field is optional — omitted from JSON when nil. It is used by and commands for auto-resolution when is not provided.
vendorNumbersales-reportsfinance-reports--vendor-numberLegacy migration: Old single-credential files () are automatically migrated to a named account on first use.
{ "keyID": ..., "issuerID": ..., "privateKeyPEM": ... }"default"json
{
"accounts": {
"personal": { "issuerID": "...", "keyID": "KEYID1", "privateKeyPEM": "..." },
"work": { "issuerID": "...", "keyID": "KEYID2", "privateKeyPEM": "...", "vendorNumber": "88012345" }
},
"active": "work"
}vendorNumber--vendor-numbersales-reportsfinance-reports旧版本迁移:首次使用时,旧版单凭据文件()会自动迁移到名为的账户。
{ "keyID": ..., "issuerID": ..., "privateKeyPEM": ... }"default"Typical Workflows
典型工作流
First-time setup (single account)
首次设置(单账户)
bash
asc auth login \
--key-id KEYID123 \
--issuer-id abc-def-456 \
--private-key-path ~/.asc/AuthKey_KEYID123.p8
asc auth check --pretty # verify source: "file"
asc apps list # works without env varsbash
asc auth login \
--key-id KEYID123 \
--issuer-id abc-def-456 \
--private-key-path ~/.asc/AuthKey_KEYID123.p8
asc auth check --pretty # 验证来源:"file"
asc apps list # 无需环境变量即可运行Multiple accounts (personal + work)
多账户(个人+工作)
bash
undefinedbash
undefinedAdd accounts
添加账户
asc auth login --key-id K1 --issuer-id I1 --private-key-path ~/.asc/personal.p8 --name personal
asc auth login --key-id K2 --issuer-id I2 --private-key-path ~/.asc/work.p8 --name work
asc auth login --key-id K1 --issuer-id I1 --private-key-path ~/.asc/personal.p8 --name personal
asc auth login --key-id K2 --issuer-id I2 --private-key-path ~/.asc/work.p8 --name work
List all
列出所有账户
asc auth list --pretty
asc auth list --pretty
Switch
切换账户
asc auth use personal
asc apps list # now uses personal account
asc auth use work
asc apps list # now uses work account
undefinedasc auth use personal
asc apps list # 现在使用个人账户
asc auth use work
asc apps list # 现在使用工作账户
undefinedSave vendor number for reports
保存供应商编号用于报告
bash
undefinedbash
undefinedDuring login
登录时保存
asc auth login --key-id K1 --issuer-id I1 --private-key-path key.p8 --vendor-number 88012345
asc auth login --key-id K1 --issuer-id I1 --private-key-path key.p8 --vendor-number 88012345
Or add to existing account
或添加到现有账户
asc auth update --vendor-number 88012345
asc auth update --vendor-number 88012345
Now reports auto-resolve vendor number
现在报告将自动解析供应商编号
asc sales-reports download --report-type SALES --sub-type SUMMARY --frequency DAILY
undefinedasc sales-reports download --report-type SALES --sub-type SUMMARY --frequency DAILY
undefinedRemove an account
移除账户
bash
asc auth list # find the name
asc auth logout --name personal
asc auth list # confirm removalbash
asc auth list # 查找账户名称
asc auth logout --name personal
asc auth list # 确认已移除Error Reference
错误参考
| Situation | Resolution |
|---|---|
| Run |
| Name contains spaces | Use hyphens/underscores: |
| 401 Unauthorized on API calls | Run |
| No credentials anywhere | Run |
| 场景 | 解决方法 |
|---|---|
| 运行 |
| 账户名称包含空格 | 使用连字符/下划线: |
| API调用返回401未授权 | 运行 |
| 无任何可用凭据 | 运行 |