question

malutra_de avatar image
0 Likes"
malutra_de asked

User token generated and what happens next?

Hi, i try to develop a Tool that import my Orders in a Database. The import is already working. But after the 2h the Token has expired. I have read so many Sites in the Api Docu. But i have not yet managed to solve my problem. I get the User Token at the Developer Account with the Sign In Button. But what exactly do I have to do to extend the term? Does anyone have detailed instructions on how I should proceed?
token renew
10 |600

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

sanjiv_developersupport avatar image
0 Likes"
sanjiv_developersupport answered
Hi @malutra_de, If you are using eBay's OAuth flow, the user token expires after 2 hours, and your application renew it programmatically by using a private refresh token for the same user, which typically expires after 18 months. Ref: https://developer.ebay.com/api-docs/static/oauth-refresh-token-request.html Best Regards eBay Developer Program
10 |600

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

malutra_de avatar image
0 Likes"
malutra_de answered
Thank you. I already read this Site and my Tests does not success. Can you tell me exactly what I have to do? I don't find an example. I have to do the refresh with the user token and then with the token I get back via the refresh?
10 |600

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

malutra_de avatar image
0 Likes"
malutra_de answered
Here is my Code i tried to get the Access Token... $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => " https://api.ebay.com/identity/v1/oauth2/token", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => 'grant_type=authorization_code&code=' . urlencode($dev_token) . '&redirect_uri=' . $redirect_uri, CURLOPT_HTTPHEADER => array( "Content-Type: application/x-www-form-urlencoded", "Authorization: Basic " . $credentials ), )); $response = curl_exec($curl); curl_close($curl); print_r($response); $dev_token is the Token i get after i push "Sign in to Production for OAuth". I also tried without urlencode() Here is the Response... {"error":"invalid_grant","error_description":"the provided authorization grant code is invalid or was issued to another client"} What is the Problem?
10 |600

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.