amzn / selling-partner-api-models

This repository contains OpenAPI models for developers to use when developing software to call Selling Partner APIs.
Apache License 2.0
580 stars 730 forks source link

How to complete the third-party authorization of the website workflow #1251

Closed wmh49877 closed 1 year ago

wmh49877 commented 3 years ago

hello,I have completed steps 0 to 3, about Step 4: Your application exchanges the LWA authorization code for a LWA refresh token. I don’t understand what it means. After step 3 ,I got acesstoken through httprequest

         String url = "https://api.amazon.com/auth/o2/token";
         String param = "grant_type=authorization_code&code=" + fbParam.get("spapi_oauth_code") + "&redirect_uri=" +
                 REDIRECT_URL + "&client_id=" + getLwaClientId + "&client_secret=" + getLwaClientSecret;
         String result = HttpClientUtils.sendPostRequest(url, param);

But step 4 requires Add the Login with Amazon SDK for JavaScript, To exchange an LWA authorization code for an LWA refresh token. I don't know what to do

BoyOhu commented 3 years ago

文档的意思:你可以两种方式获授权而已, image,要么用他官方提供的sdk,要么自己通过授权码授权后获取,你现在的这种就是自己通过授权码已经授权了,你可以在卖家后台里的管理程序里看到已经授权了,那个程序刷新token的话参考这个:https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md#connecting-to-the-selling-partner-api,把参数替换,就能获取refresh_token

wmh49877 commented 3 years ago

文档的意思:你可以两种方式获授权而已, image,要么用他官方提供的sdk,要么自己通过授权码授权后获取,你现在的这种就是自己通过授权码已经授权了,你可以在卖家后台里的管理程序里看到已经授权了,那个程序刷新token的话参考这个:https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md#connecting-to-the-selling-partner-api,把参数替换,就能获取refresh_token。

感谢,我再研究一下 ,,文档把所有的都写一起了我就比较懵逼.

BoyOhu commented 3 years ago

是的,看文档也有的地方很懵,我现在都有一些疑问。真希望国内开发人员可以组件一个关于这方面得交流群。

ianrussel commented 3 years ago

I think its better to use language people mostly understand. If I write answer in hindu or arabic it will only helpful to people who know how to speak arabic or hindu. :)

wmh49877 commented 3 years ago

I think its better to use language people mostly understand. If I write answer in hindu or arabic it will only helpful to people who know how to speak arabic or hindu. :)

sorry BobOhu is mean
Either use the SDK officially provided by him, or obtain it after authorization through the authorization code. What you have now is that you have been authorized through the authorization code. You can see that you have been authorized in the management program in the seller's backend, and the program refreshes. Refer to this for token: https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md#connecting-to-the-selling-partner -api, replace the parameters to get refresh_token.

Even so, I still feel that the official documents are not detailed enough and confusing

TKwheat commented 2 years ago

Sorry, may I know how you solved it in the end?

github-actions[bot] commented 1 year ago

This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please feel free to open a new issue and make a reference to this one.

github-actions[bot] commented 1 year ago

closed for inactivity