davidtsadler / ebay-sdk-php

An eBay SDK for PHP. Use the eBay API in your PHP projects.
Apache License 2.0
349 stars 341 forks source link

Suddenly getting invalid_grant for refresh_token in production #226

Closed Wohntrends-Shop-Strunz closed 4 years ago

Wohntrends-Shop-Strunz commented 5 years ago

We have been using the OAuth refresh_token stuff for a few months. Then we noticed our packages are not confirmed to Ebay automatically. Since it's a busy time we didn't have time to imedially dig into the log files. After checking them we noticed the error and realized the last token refresh was around Sep. 13th since the last token saved in the json config file we generated was having a expiration date on that day.

Now our first guess was: oh damn, did we screw up? Did the token expire earlier then expected? New token generated, etc.. No change. Then we made the test and switched to sandbox... and of course refresh token there is working, so we assume the code is fine.

What the hell could we be missing? Was there a change in Ebay which is only reflected on the production site and ignored on the sandbox?

We are not actually using a redirect URL, since the only account we log in with is our own. So all we do is copy and paste the refresh token from the URL, URL decode them using Notepad++ and paste them into the JSON file. Removing the comment from the SANDBOX line is the difference between sandbox and production: require_once 'classes/cEbay.php'; // cEbay::$ACTIVE_SYSTEM = cEbay::SANDBOX; cEbay::$DEBUG = true; echo json_encode(cEbay::getInstance(cEbay::SERVICE_FULFILLMENT, Ebay::getSiteIdForMarketplace('DE'))->Fulfillment_getOrders()->toArray()); On the JSON file sandbox and production is the difference between getting the index 0 and 1. There is code side no known difference.

PS: Creating an auth code in production using the dev side and using this token does work as login, but we really don't have the time to update the token every few hours by hand...

michabbb commented 5 years ago

nice story, what do you expact here without any useful informations ?

Wohntrends-Shop-Strunz commented 5 years ago

What kind of information would be useful? I could paste 2000 lines of codes and would be useless to you.

The question is: What could have changed in production what didn't change in sandbox? And some weeks ago? And why, even when the token might have been become invalid for whatever reason, even a new token does not work? Has someone similar issues or are we kind of "the only one"? If it was our code messed up by some change in a sub sub modul, why would it still work for sandbox?

michabbb commented 5 years ago

first of all, if 2000 lines of code are usless, so why creating an issue here in the first place ? that makes no sense, because this project is about the SDK, not general problems with ebay. therefor, you should use the offical ebay forum or the developer support, there you get answers about your none SDK related questions.