question

gooddeals512 avatar image
0 Likes"
gooddeals512 asked

cannot run shopping api by oauth

I use X-EBAY-API-IAF-TOKEN:{access_token} as header. I get response "Application ID invalid.". But if I change back to X-EBAY-API-APP-ID, I can get normal response. May someone please help?

shopping api
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.

sagar_developersupport avatar image
1 Like"
sagar_developersupport answered

Hi @gooddeals512 ,

For making the Shopping API, you need to authenticate with an OAuth application access token using the X-EBAY-API-IAF-TOKEN HTTP.

See here https://developer.ebay.com/api-docs/static/oauth-client-credentials-grant.html for the The client credentials grant flow topic for more information on generating and managing OAuth application access tokens .

Also, please see "Making an API Call" section for Shopping API mentioned below, to know more about making the call.
Ref: https://developer.ebay.com/devzone/shopping/docs/Concepts/ShoppingAPI_FormatOverview.html

Application access token expires in 7,200 seconds, meaning this token is valid for two hours from the time it was generated. For continued access after the token expires, you must mint a new token.


Ref: https://developer.ebay.com/api-docs/static/oauth-client-credentials-grant.html

Best regards ,
eBay Developer Support

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.

gooddeals512 avatar image
0 Likes"
gooddeals512 answered

Yes. I use the access token in other Restful API now. And I put correct access token for header X-EBAY-API-IAF-TOKEN. If I use incorrect token, it show response as "Invalid token. Please specify a valid token as HTTP header" .

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.

refresh_ecommerce avatar image
0 Likes"
refresh_ecommerce answered

I'm getting the same issues herer. We've integrated with OAuth for the rest of eBay where required but the shopping API is returning Application ID invalid when we make identical calls, swapping out the AppID in the URL for our OAuth Access key header. Example Call code below:

$headers[] = "X-EBAY-API-IAF-TOKEN: Bearer ".$accessToken;

Called URL: http://open.api.ebay.com/shopping?callname=GetSingleItem&IncludeSelector=Variations,ItemSpecifics,Compatibility&Item.ReturnPolicy.EAN&version=1199&ItemID=">http://open.api.ebay.com/shopping?callname=GetSingleItem&IncludeSelector=Variations,ItemSpecifics,Compatibility&Item.ReturnPolicy.EAN&version=1199&ItemID=ONEOROURSTOREITEMIDS&responseencoding=XML

To save me from banging my head against a brick wall for the next while, What's wrong here?

I've tried without the Bearer text in the Header also but only to receive the same result. The request itself is good it appears and the access token works in every other call I've written up from our website. But not in the soon to be expiring Shopping API.

Is there a different token that needs to be used / generated for Shopping API perhaps?

Below is the error response in full.

stdClass Object (
[Timestamp] => 2021-06-14T10:39:03.274Z
[Ack] => Failure    
[Errors] => Array([0] => stdClass Object
				(                    
				[ShortMessage] => Application ID invalid.
				[LongMessage] => Application ID invalid.                    
				[ErrorCode] => 1.20                    
				[SeverityCode] => Error                    
				[ErrorClassification] => RequestError
				)        
)     
[Build] => E1199_CORE_APILW_19146596_R1    
[Version] => 1199

Thanks in advance

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.

sagar_developersupport avatar image
1 Like"
sagar_developersupport answered

Hi @refresh_ecommerce,

It seems like you are using a user access token for executing the shopping API call. If you want to execute the Shopping API calls, please generate an OAuth application access token with scope https://api.ebay.com/oauth/api_scope and try to execute the call with an application access token not with a user access token.


Ref: https://developer.ebay.com/api-docs/static/oauth-client-credentials-grant.html

Best regards ,
eBay Developer Support

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

Thanks @sagar_developersupport, that's exactly the info I was after, integrating that side of things today. Thank you for both the advice and saving my remaining braincells from the potential head banging :)

1 Like 1 ·
shipscript avatar image
0 Likes"
shipscript answered

I had the same problem with my Shopping API application oauth that generates "client-credentials" for the application (not the end user "authorization_code"). I added the scope parameter to my basic oauth call and it worked.

But it only worked when I wrapped the call in a curl shell that transmitted the oauth header. I was unsuccessful trying to add it as a url query. The documentation seems to indicate that the query authorization is kaput, although the query can be used in a curl "get" to transfer the other basic call parameters.

I've spent way too much time learning how to use OAUTH with the shopping API, in a PHP environment, but now that I have it working, I am willing to share.

You can find me on this eBay forum:

https://community.ebay.com/t5/Seller-Tools/bd-p/tools-apps-db


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

Hello @shipscript - I am having the same problem as the original poster. Would you mind sharing how you got it to work please?
0 Likes 0 ·
shipscript avatar image
1 Like"
shipscript answered

@cardimart

I shared my entire code set with eBay's developer team, hoping they would build a sample PHP interface. Are you using PHP? If so, that is what I can share.

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.

cardimart avatar image
0 Likes"
cardimart answered

@shipscript - yes I am using PHP.... well trying to with my limited skillset!

If you would be happy to share that would be amazing, as I've tried for several days to get my head around it but am struggling if I'm brutally honest :(

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

is there a reason not hiring a developer when having the knowledge of having "limited skills"?
0 Likes 0 ·
The best way to improve limited skills is to continue development and learn from examples that others generously share. That's how I learn.
1 Like 1 ·

Hi @micab2003 - I'm trying to do as much as I can with the limited knowledge I have, whilst trying to learn as I go along.

By hiring a developer straight away I'd learn nothing :)

Although if my efforts continue to prove unsuccessful I may well end up hiring one! :)

0 Likes 0 ·
shipscript avatar image
1 Like"
shipscript answered

@cardimart

Believe me, I struggled for many weeks trying to get my head around it. It is just too obtuse for someone who has never been exposed to it. It didn't help that eBay renamed the AppID as Client ID and the CertID as Client Secret without initially displaying that relationship in the key set. It appeared after turning on the Oauth feature on my 10 year old account, but until then, I had no idea what was being referenced or how to get these values.

The migration instructions to Oauth are too sparse to work with, and assume some knowledge of other features. I even contacted support, but their advice was misguided (or sometimes just guessing) because they were not that familiar with the issues that could arise. So, after researching and trying various scenarios, it finally came together, and I am happy to share and alleviate some of the misery.

It is important to get the headers and the scope correct for the API call being used. My example is for a program that does not require access to private user data, so it implements the "Client credentials grant flow" using an Application Token.


I've posted the code here as plain text and it can be used, as-is, by placing the correct files on a PHP server (including your own credential files):

http://shipscript.com/ebayhelp/developer/Oauth_getBasicToken_example.htm




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

@shipscript - thank you very much for the help, it is truly appreciated.

Reading your post made me realise that I've been getting myself into such a muddle between the Client Credentials flow and Application Token and the User Token... especially as it appears I don't need the latter.

Many thanks once again for sharing the code and helping me (and no doubt many others out).

I'll give the code a go and let you know how I get on.

1 Like 1 ·
cardimart avatar image
1 Like"
cardimart answered

@shipscript - delighted to say that the code you kindly provided worked like a charm.

The instructions and commented code were a huge help also and meant I learnt a lot as I went along.

Thank you very much for all your help.

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

You're most welcome! I'm happy you got your code running!

0 Likes 0 ·

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.