question

westobetha avatar image
0 Likes"
westobetha asked

OAuth token working for Browse Api but not working for Shopping

After successfully minting a new OAuth token through my web application

I'm able to make calls on the Browse API successfully.

I use the same token in the request header X-EBAY-API-IAF-TOKEN for a http get shopping api call: GetMultipleItems

http://open.api.ebay.com/shopping?callname=GetMultipleItems&responseencoding=JSON&siteid=0&version=1157&ItemID=174706471589&IncludeSelector=Details,ItemSpecifics,ShippingCosts,TextDescription

I get an error 1.20 - "Application ID invalid."



If I use a token from the "Get OAuth Application Token" link on the page 'Application access keys'->'User Tokens'

The GetMultipleItems call will be successful.


I assume it's got something to do with the scopes but i've included https://api.ebay.com/oauth/api_scope in the scopes.


I'ved tried both HTTP and HTTPS calls with the same results

tldr: oauth tokens don't work for shopping api unless i manully get a token from the user token page. what am i doing wrong?

oauth scopes
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.

clickimusprime avatar image
1 Like"
clickimusprime answered

Sounds like you are using the User Tokens. You need to use the client credentials grant flow. This will give you a long term token for the application. You must also create the token with the proper scope(s) included. The same token works for Browse API.

See the first paragraph of the GetMultipleItems docs.


· 1
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.

Wow! Thank you so much. I didn't know there was only 1 token.

0 Likes 0 ·
afridigems avatar image
0 Likes"
afridigems answered

I am having the same issue.

X-EBAY-API-IAF-TOKEN is also not working on API Explorer scratchpad.

,

I am having the same problem.


"If I use a token from the "Get OAuth Application Token" link on the page 'Application access keys'->'User Tokens'

The GetMultipleItems call will be successful."


This is not the case there. OAuth token from there is also not working. You might not have noticed that, when you select shopping API->GetMultipleItems , the call "HTTP Headers", does not take Token, rather it put the APP-ID, means using old method.

I tried to put the Token headers there and muanlly put the Token, but all in vain.

I think there is some technical issue on eBay backed.

Ebay may please resolve the issue.


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.

westobetha avatar image
0 Likes"
westobetha answered
This is the javascript code i use to make calls.

I can confirm the token copy and pasted from the 'Get OAuth Application Token' link does work.


fetch(' http://open.api.ebay.com/shopping?callname=GetMultipleItems&responseencoding=JSON&siteid=0&version=1157&ItemID=174706471589', { method: "GET", headers: { "X-EBAY-API-IAF-TOKEN": copy_pasted_token } }) .then(res => res.json())

.then(json=>do_stuff_with_json_response_function(json))

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.

westobetha avatar image
0 Likes"
westobetha answered

There are 3 ways to get a token...


1. 'Get OAuth Application Token'

2. 'Get a User Token Here -> Sign in to Production/Sandbox for OAuth

3. 'Get a Token from eBay via Your Application'


I've confirmed that method 1 token works for Shopping API and Browse

Method 2 and 3 does not work for shopping API but works for Browse

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.