question

jomarc-82 avatar image
0 Likes"
jomarc-82 asked ·

Use search API without manual login

Apologies if this is an easy question. I'm new to the eBay API and am trying to create a function for my PHP website which shows active ebay listings for whatever product page the script is loaded on.

I believe I need to use the browse API with search call, which seems to work well. The problem as far as I can tell is that the oAuth token required to make the call expires, needing to be re-generated.

How can I get a token that just works continuously, without needing to log in frequently to get a new token?

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

1 Answer

· Write an Answer
uncommon_1 avatar image
0 Likes"
uncommon_1 answered ·

You need an application access token. These tokens expire after 7200 seconds or two hours which is part of their security if they are compromised, but that same token can be used by all of your pages during that time.

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

That page describes the process. A cron job on your server can renew the token before it expires. You need a cURL request to get the token and another to make the call.

Be very security conscious with your credentials and token.

· 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 - that makes sense. I'm just trying to put together a PHP script to run as a cron job and am getting this error:

{"error":"unsupported_grant_type","error_description":"grant type in request is not supported by the authorization server"}

Here is my PHP code. Is anyone able to advise where I'm going wrong?

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.