Skip to content

Support Creators API credential v3.x#51

Merged
spiegel-im-spiegel merged 1 commit into
goark:masterfrom
Oakes6:chores/oauth-v3
May 7, 2026
Merged

Support Creators API credential v3.x#51
spiegel-im-spiegel merged 1 commit into
goark:masterfrom
Oakes6:chores/oauth-v3

Conversation

@Oakes6

@Oakes6 Oakes6 commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends the client so v3.1 / v3.2 / v3.3 credentials work end-to-end: correct Login with Amazon token URLs, HTTP Basic client authentication, scope creatorsapi::default, and catalog Authorization: Bearer <token> without a Version suffix. v2.1 / v2.2 / v2.3 (Cognito) behavior is unchanged and remains available via WithCredentialVersion and the existing constants.

Motivation

New Associates Central credential sets use the v3.x path. The library previously only mapped 2.x to Cognito; 3.x strings were rejected by WithCredentialVersion, and defaults assumed Cognito, so v3 credentials failed token exchange or API auth.

What changed

  • marketplace.go: Added CredentialVersionNAv3 (3.1), CredentialVersionEUv3 (3.2), CredentialVersionFEv3 (3.3). versionMap now defaults each built-in locale to the matching v3 code (same NA/EU/FE grouping as before).
  • server.go: authEndpointMap entries for LwA (api.amazon.com, api.amazon.co.uk, api.amazon.co.jp), isLWACredentialVersion, and CreateClient wires lwaFlow into the token manager.
  • auth.go: tokenManager branches: Cognito (form client_id / client_secret, scope creatorsapi/default) vs LwA (Basic auth, scope creatorsapi::default). authorizationHeader drops , Version … for LwA.
  • client.go: Stores lwaFlow and passes it into authorizationHeader for catalog requests.
  • Tests: Default client path asserts LwA token request shape and bare Bearer catalog header; TestClientLegacyCognitoCredentialVersion pins 2.x Cognito + Version behavior.
  • README / examples: Document v2 vs v3, default 3.1 / 3.3 in snippets, and legacy override via WithCredentialVersion("2.1"|…).

Migration / breaking note

Default credential version per marketplace is now v3.x, matching typical new credentials. Integrations still on Cognito-only 2.x credentials must set e.g. WithCredentialVersion(paapi5.CredentialVersionNA) (or "2.2" / "2.3") on CreateClient.

How to verify

go test ./...
golangci-lint run

@Oakes6

Oakes6 commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

@spiegel-im-spiegel Adding default support for v3 generated credentials. This defaults to v3 with options for auth'ing with v2. Amazon changing things at a break-neck pace right now.

@spiegel-im-spiegel spiegel-im-spiegel merged commit ecc0452 into goark:master May 7, 2026
1 check passed
@spiegel-im-spiegel

Copy link
Copy Markdown
Member

Thanks for the update and for moving quickly on the v3 credential support work. Merged now — really appreciate the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants