當試圖使用https://api.ebay.com/sell/inventory/v1/offer/OFFER_ID端點獲取優惠信息時,我需要幫助理解令牌問題。Ebay getOffer API令牌問題
我有2種令牌: 用戶令牌和訪問令牌。
文檔清楚地給了我必須使用USER TOKEN的解釋。 我使用Auth'n'Auth方法制作它,我同意作爲賣家提供許可。現在我想使用此令牌這樣的:
public void getOffer(@RequestBody Map<String, String> args) throws IOException {
HttpClient client = HttpClientBuilder.create().build();
HttpGet httpGet = new HttpGet("https://api.ebay.com/sell/inventory/v1/offer/OFFER_ID");
httpGet.setHeader("Authorization", "Bearer " + args.get("token"));
httpGet.setHeader("Content-Language", "en-US");
HttpResponse response = client.execute(httpGet);
System.out.print(EntityUtils.toString(response.getEntity()));
}
它讓我回: { "errors" : [ { "errorId" : 1001, "domain" : "OAuth", "category" : "REQUEST", "message" : "Invalid access token", "longMessage" : "Invalid access token. Check the value of the Authorization HTTP request header." } ] }
什麼可能是錯誤的,我錯過了什麼措施? 預先感謝您