Amazon Ads Authorization and Ad Account Management
Amazon Ads authorization (LWA OAuth), profile discovery, and access token management. Prerequisite for downstream skills.
Downstream:
linkfox-amazon-ads-entity
(entity query),
linkfox-amazon-ads-report
(reports).
Core Concepts
- 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
- accessToken Valid for 1 Hour: After expiration, downstream returns HTTP 401; can renew using
Available Scripts
| Script | Function |
|---|
| Generate authorization URL for new accounts ( required) |
| List authorized accounts × sites (aggregated by profileId) |
| List profiles ( triggers upstream refresh) |
| Refresh accessToken |
| Query tokens (for downstream use) |
See
for input parameters, response fields, and error codes.
Supported Regions
(US, Canada, Mexico, Brazil) /
(UK, Germany, France, Italy, Spain, Netherlands, India, Middle East, etc.) /
(Japan, Australia, New Zealand). Default is
.
Usage Scenarios
1. New Account Authorization
- Ask the user for (non-empty string for identification)
- Call to get the URL → instruct the user to open it in a browser
- After authorization is completed, the system automatically stores the token + syncs profiles
- Optional: Call to confirm
2. List Authorized Accounts
Call
and display
profileId / accountInfoName / countryCode / region
.
3. Refresh Expired Tokens
When downstream returns HTTP 401 or contains
/
, call
(pass
or
).
4. Resolve profileId for Downstream (High Frequency)
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 , no need to ask |
| ≥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
):
- 美国 / US → ; 英国 / UK → ; 日本 / JP → ; 德国 / DE →
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
- Ask for before calling
- 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
When opening the authorization link, a 400 error occurs and the client_id appears to be corrupted
Symptom: Spaces /
appear in the middle of
in the URL, Amazon reports
StegoRuntimeOAuth2ClientManager:getClientDefinition
.
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 +
~/.cache/linkfox/last_authorize_url.txt
,
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.
Authorization callback page displays
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
- 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 →
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.
For more high-quality, professional cross-border e-commerce skills, visit LinkFox Skills.