linkfox-amazon-ads-auth
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAmazon Ads 授权与广告账户管理
Amazon Ads Authorization and Ad Account Management
Amazon Ads 的授权(LWA OAuth)、profile 发现、访问令牌管理。下游 skill 的前置依赖。
下游:(实体查询)、(报告)。
linkfox-amazon-ads-entitylinkfox-amazon-ads-reportAmazon Ads authorization (LWA OAuth), profile discovery, and access token management. Prerequisite for downstream skills.
Downstream: (entity query), (reports).
linkfox-amazon-ads-entitylinkfox-amazon-ads-reportCore Concepts
Core Concepts
- 授权流程:生成 URL → 用户浏览器授权 → 系统存 token + 同步 profile
- 一次授权多 profile:每个 marketplace(US/UK/JP…)一个 profileId;下游调用必须带 profileId
- accountName 必填:调 前必须问用户要一个非空账号名
authorize_url.py - accessToken 1 小时有效;过期后下游返回 HTTP 401,可用 续签
refresh_token.py
- Authorization Process: Generate URL → User authorizes via browser → System stores token + syncs profiles
- One Authorization for Multiple Profiles: One profileId per marketplace (US/UK/JP…); downstream calls must include profileId
- accountName Required: Must ask the user for a non-empty account name before calling
authorize_url.py - accessToken Valid for 1 Hour: After expiration, downstream returns HTTP 401; can renew using
refresh_token.py
可用脚本
Available Scripts
| 脚本 | 作用 |
|---|---|
| 为新账号生成授权 URL( |
| 列出已授权的账号 × 站点(按 profileId 聚合) |
| 列 profile 列表( |
| 刷新 accessToken |
| 查 token(供下游使用) |
入参、响应字段、错误码见 。
references/api.md| Script | Function |
|---|---|
| Generate authorization URL for new accounts ( |
| List authorized accounts × sites (aggregated by profileId) |
| List profiles ( |
| Refresh accessToken |
| Query tokens (for downstream use) |
See for input parameters, response fields, and error codes.
references/api.md支持区域
Supported Regions
NAEUFENANAEUFENAUsage Scenarios
Usage Scenarios
1. 新授权账号
1. New Account Authorization
- 问用户要 (非空字符串,用于识别)
accountName - 调 拿 URL → 给用户在浏览器打开
authorize_url.py - 授权完成后系统自动存 token + 同步 profile
- 可选:调 确认
authorized_stores.py
- Ask the user for (non-empty string for identification)
accountName - Call to get the URL → instruct the user to open it in a browser
authorize_url.py - After authorization is completed, the system automatically stores the token + syncs profiles
- Optional: Call to confirm
authorized_stores.py
2. 列已授权账号
2. List Authorized Accounts
调 ,展示 。
authorized_stores.pyprofileId / accountInfoName / countryCode / regionCall and display .
authorized_stores.pyprofileId / accountInfoName / countryCode / region3. 刷新过期令牌
3. Refresh Expired Tokens
下游返回 HTTP 401 或含 / 时,调 (传 或 )。
expiredunauthorizedrefresh_token.pyprofileIdauthRecordIdWhen downstream returns HTTP 401 or contains / , call (pass or ).
expiredunauthorizedrefresh_token.pyprofileIdauthRecordId4. 给下游解析 profileId(高频)
4. Resolve profileId for Downstream (High Frequency)
用户只说自然语言("美国站"、"我的店铺"),不要让用户报 profileId 数字。
| 用户上下文 | Agent 动作 |
|---|---|
| 只授权 1 个账号 | 按 |
| 授权 ≥ 2 个账号 + 只说站点 | 按 |
| 同时给出 accountName + 站点 | 直接定位 |
| 显式给出 profileId 数字 | 直接用 |
站点关键词映射参考(以 真实 兜底):
authorized_storescountryCode- 美国 / US → ;英国 / UK →
US;日本 / JP →UK;德国 / DE →JPDE
静默原则:映射成功时不播报 profileId 数值;仅在歧义或失败时向用户开口。
Users only use natural language ("US site", "my store"), do not ask users to provide the numeric profileId.
| User Context | Agent Action |
|---|---|
| Only one account authorized | Directly locate by |
| ≥2 accounts authorized + only mentions site | Clarify with the user by |
| Provides both accountName + site | Directly locate |
| Explicitly provides numeric profileId | Use it directly |
Site keyword mapping reference (fall back to actual from ):
countryCodeauthorized_stores- 美国 / US → ; 英国 / UK →
US; 日本 / JP →UK; 德国 / DE →JPDE
Silent Principle: Do not announce the profileId value when mapping is successful; only communicate with the user in case of ambiguity or failure.
调用原则
Calling Principles
- 先问 再调
accountNameauthorize_url.py - 不输出完整 accessToken / refreshToken;脚本已做掩码,不要在摘要里还原
- 授权失败按错误码解释原因;不擅自重试
- Ask for before calling
accountNameauthorize_url.py - Do not output complete accessToken / refreshToken; scripts have already masked them, do not restore them in summaries
- Explain the reason for authorization failure based on error codes; do not retry without permission
常见问题
Common Issues
授权链接打开报 400,client_id 看起来被污染
When opening the authorization link, a 400 error occurs and the client_id appears to be corrupted
现象:URL 里 中间出现空格 / ,Amazon 报 。
原因:授权链接 ~270 字符,从终端 / 聊天窗口复制时被软换行插入空格。
解决: 成功后会同步写到剪贴板 + ,从这两处复制;浏览器地址栏 Ctrl+V 即可。建议无痕窗口打开。
client_id+StegoRuntimeOAuth2ClientManager:getClientDefinitionauthorize_url.py~/.cache/linkfox/last_authorize_url.txtSymptom: Spaces / appear in the middle of in the URL, Amazon reports .
Cause: The authorization link is ~270 characters long, and soft line breaks insert spaces when copied from the terminal / chat window.
Solution: After succeeds, the URL is automatically written to the clipboard + , copy from these two places; paste directly into the browser address bar using Ctrl+V. It is recommended to open it in an incognito window.
+client_idStegoRuntimeOAuth2ClientManager:getClientDefinitionauthorize_url.py~/.cache/linkfox/last_authorize_url.txt授权回调页显示 profile_sync_failed
profile_sync_failedAuthorization callback page displays profile_sync_failed
profile_sync_failed原因:当前 Amazon 账号未在广告后台创建"经理账户(Manager Account)"并关联广告账户。
解决:登录 Amazon Ads 控制台 → Manager accounts → 关联账户,重新授权。
Cause: The current Amazon account has not created a "Manager Account" in the advertising backend and linked it to the ad account.
Solution: Log in to Amazon Ads Console → Manager accounts → Link accounts, then re-authorize.
Not Applicable
Not Applicable
- 查广告活动 / 组 / 关键词 / 商品广告 / 定向 →
linkfox-amazon-ads-entity - 拉广告报告(含指标) →
linkfox-amazon-ads-report - 修改 / 创建 / 删除广告 → 本系列为只读
- 店铺订单 / 库存 / 财务 →
linkfox-amazon-store-*
Feedback:
Auto-detect and report feedback via the Feedback API when any of the following apply:
- The functionality or purpose described in this skill does not match actual behavior
- The skill's results do not match the user's intent
- The user expresses dissatisfaction or praise about this skill
- Anything you believe could be improved
Call the feedback API as specified in . Do not interrupt the user's flow.
references/api.mdFor more high-quality, professional cross-border e-commerce skills, visit LinkFox Skills.
- Query ad campaigns / groups / keywords / product ads / targeting →
linkfox-amazon-ads-entity - Pull ad reports (including metrics) →
linkfox-amazon-ads-report - Modify / create / delete ads → This series is read-only
- Store orders / inventory / finance →
linkfox-amazon-store-*
Feedback:
Auto-detect and report feedback via the Feedback API when any of the following apply:
- The functionality or purpose described in this skill does not match actual behavior
- The skill's results do not match the user's intent
- The user expresses dissatisfaction or praise about this skill
- Anything you believe could be improved
Call the feedback API as specified in . Do not interrupt the user's flow.
references/api.mdFor more high-quality, professional cross-border e-commerce skills, visit LinkFox Skills.