Repository navigation
Add AliExpress Affiliate and Dropshipping connectors with IOP request signing - #1346
Merged
Merged
Conversation
Opt-in on the query-signing path: ${sortedParams} and ${apiPath} template
variables, encoding hex-upper and timestampFormat ms. Signatures without
these options are computed as before (Kaufland and Shopee pins unchanged).
Tests pin both worked examples of the AliExpress Open Platform docs.
12 read tools on the AliExpress Open Platform Affiliate API: product search, hot products, product and SKU details, shipping, coupons, featured promotions, affiliate links and affiliate orders. Signed with the app key and secret, IOP style; the tracking ID goes into every link.
8 tools on the AliExpress Dropshipping API: product search, product details, freight, order, tracking and member benefits, plus order creation installed switched off (orders are created unpaid). Uses a pasted access token; an expired token is reported as an auth error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds AliExpress to the catalog as two connectors, AliExpress Affiliate and AliExpress Dropshipping, and extends the REST engine's HMAC signing so it can sign Alibaba "IOP" gateway requests. The two connectors are separate because AliExpress does not allow one Open Platform account to hold both an Affiliate and a Dropshipping app, so their credentials always differ.
The signing extension is opt-in. Kaufland and Shopee are signed exactly as before. Cloud and self-hosted behave the same: nothing here depends on the deployment mode.
Alibaba.com and 1688 are not included. The reasons are under "Not built" below.
Changes
${sortedParams}: every parameter sent, sorted by name and concatenated as name + value. It covers the query as sent (statics, credential parameters and the timestamp included) and the fields of a form-urlencoded body. Arrays and objects give the same pairs the query serializer sends. Thesignparameter and empty values are left out, as in the official SDK.${apiPath}: the request path below the connector'sbaseUrl. It covers IOP/restsystem calls, which sign/auth/token/create....signature.encoding: "hex-upper".signature.timestampFormat: "s" | "ms".flattenParamsplus encoding; it gives the same output.docs/tool-definition.md(new "Query signing" subsection, which also documents the Shopee options).aliexpress-affiliate(12 tools, all read-only): categories, product search, hot products, product details, SKU details, shipping, promotions and coupons, affiliate link generation, featured promotions and their products, affiliate orders (list and by id). Needs app key, app secret and a Portals tracking ID.aliexpress-dropshipping(8 tools):aliexpress_dropshipping_create_order(readOnlyHint: false) is installed switched off. It creates unpaid orders; the documented automatic-payment switch is never sent.errorWhenrules for the gateway's HTTP 200error_response, mapped to 401, 403, 429 and 400.aliexpress.svg(simple-icons 13.21.0, brand color #FF4747), catalog regenerated, quoted counts 572 → 574,llms.txtandllms-full.txtregenerated.rest.engine.shopee.spec.ts: the list of query-signed HMAC adapters now includes the two new ones. Kaufland is still checked to use none of the new fields.rest.engine.hmac-pin.spec.tsis unchanged and still passes.Verified against
https://api-sg.aliexpress.com/sync?method=..., no path prefix,methodis signed as a parameter.https://api-sg.aliexpress.com/rest{api_path}, API path in front.sign_method=sha256.helloworld):F7F7926B...5BBBfor the business call.35607762...4D81for/auth/token/create.IopUtils.signApiRequest,TopExecutor,GopExecutor):Arrays.sortand empty values skipped.method; GOP calls prefix the API name.Date.getTime()(milliseconds).{"error_response":{"type":"ISV","code":"InvalidAppKey","msg":...}}.Access tokens (dropshipping)
I went with a pasted token rather than a token provider. The docs (docId 1590, 1364, 1365) say:
So a refresh flow could stretch one authorization from about 30 days to at most about 60, and a new sign-in would still be needed after that. That gain doesn't justify a Shopee-style provider with its own authorize, callback and dashboard pieces. The user gets the token from the Open Platform API test tool ("Get Token").
Not built
${apiPath}${sortedParams}would sign it), but:Type
Testing
Commands and results:
node scripts/validate-adapters.mjs --warnaliexpress-*node scripts/regenerate-catalog.mjsnode scripts/adapter-count.mjs --checknode scripts/generate-llms-txt.mjsnpx tsc --noEmit -p tsconfig.jsonnpx jest src/connectors/engines/rest.enginenpx jest src/adapters/intl/aliexpress-npm testnpm run lintThe live parts are gated by
RUN_ALIEXPRESS_AFFILIATE_LIVE=1andRUN_ALIEXPRESS_DROPSHIPPING_LIVE=1and only read. They were not run: no AliExpress affiliate or dropshipping app was available.Checklist
npm test)Related Issues
None.
Open points for review
access_tokenon/sync, while the Java SDK's TOP executor sends it assession. The adapter follows the HTTP sample, which is not confirmed live.apiConsole.test.getToken), but I could not follow it without an account.errorWhencodes. The status mapping uses patterns (Token|Session|Signature|AppKey→ 401 and so on) rather than an official code list.InvalidAppKeyandMissingParameterwere seen live; the others are inferred.resp_code402 or 405,is_success: false) are passed through to the model, because their path depends on the API name.