python-amazon-sp-api icon indicating copy to clipboard operation
python-amazon-sp-api copied to clipboard

Credentials dictionary expects LWA App ID but Amazon API expects LWA Client ID

Open JasonSanDiego opened this issue 1 year ago • 0 comments

Describe the bug Per the quickstart, this is the expected credentials to provide in all endpoint calls:

    refresh_token='your_refresh_token',
    lwa_app_id='your_lwa_app_id',
    lwa_client_secret='your_lwa_client_secret'
)

However, I could not get this to work by providing the LWA_APP_ID (looks like amzn1.sp.solution...) and it only worked when I provided the LWA Client ID (looks like amzn1.application-oa2-client...).

Amazon's documentation backs this up. Per this page, these are the required parameters to use the refresh token to get an access token:

  • grant_type
  • refresh_token
  • scope
  • client_id
  • client_secret

To Reproduce Make a call to Reports endpoint using sp_api.api.request_report_id. Does not work when using APP ID. Authorization error is returned.

Expected behavior Return payload report ID

Additional Context If I'm correct and Client ID is expected, I would suggest renaming the key in the expected credentials dict to match. Since this would be a breaking change, you could possibly keep lwa_app_id as an alternative option for some time and then deprecate it eventually.

JasonSanDiego avatar Aug 21 '24 20:08 JasonSanDiego