question

bibliomania_be avatar image
0 Likes"
bibliomania_be asked

Unable to obtain Access token

[my previous question never appeared on the forums, so I repost it here] Hello all, For historic reasons, I'm developing this project in Classic ASP. Never been a problem with any of the APIs I've worked with (Amazon, Paypal, you name it) but I'm stuck at the very basics of the new Sell API when it comes to obtain an Access token from an Authorization code. Which makes me wonder if maybe there may be some issues with the documentation? Here's my code: [CODE] t_url = " https://api.sandbox.ebay.com/identity/v1/oauth2/token" t_method = "POST" t_auth_code = "[code_obtained_successfully_from_ebay]" t_runame = "[my_sandbox_runame]" t_auth_api = Base64Encode([my_sandbox_app_id] & ":" & [my_sandbox_cert_id]) t_body = "grant_type=authorization_code&code=" & server.URLencode(t_auth_code) & "&redirect_uri=" & t_runame set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP") xmlHttp.open t_method, t_url, false xmlHttp.setRequestHeader "Authorization", "Basic " & t_auth_api xmlHttp.setRequestHeader "Accept-Charset", "utf-8" xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" xmlHttp.send(t_body) t_answer = xmlHttp.responseText [/CODE] The API replies with : {"error":"invalid_request","error_description":"'Authorization' is missing the the header:","error_uri":null} What am I doing wrong here? I checked the following: - the BASE64 encoding of app_id:cert_id is correct - tried to URLencode or not URLencode Runame (which makes me wonder, because the Content-Type is x-www-form-urlencoded so that should not be necessary unless you pass it as a Querystring) - tried to authenticate with "Bearer" and oauth token, to no avail. I'd be grateful if anyone could put me on the right way here. Thanks in advance, Chris
user token
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

zhuowei.developersupport@ebay.com avatar image
0 Likes"
zhuowei.developersupport@ebay.com answered
Hi bibliomania_be, Can you give it a try and see if you are able to get access token via Postman tool? Best Regards, ![alt text][1] [1]: /storage/temp/1217-code2accesstoken-request.png

10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

turboperformancecentre avatar image
0 Likes"
turboperformancecentre answered
Thank you, just tried this (both encoded and decoded 'code' value) ![alt text][1] ![alt text][2] [1]: /storage/temp/1236-screen-shot-2017-02-27-at-201204.png [2]: /storage/temp/1237-screen-shot-2017-02-27-at-201233.png

10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.