Closed saulyx closed 4 years ago
maybe my little ebay oauth playground does help you in some way....
@michabbb yeah, we tried.. Here's the outcome:
https://www.dropbox.com/s/bnwsjrfqw6anjpx/Screen%20Shot%202019-04-02%20at%2008.24.52.png?dl=0
not sure what on earth is going on..
as always: when things don´t work as expected: do it RAW. don´t use any frameworks where you don´t know what´s going on inside. grab postman and do the requests there to be 100% sure, that it´s not a config or SDK problem. beside that, you should have checked if you enabled oauth for your production keys in your ebay dev account, did you ? ;)
@michabbb thats why I linked the stackoverflow article, as it's mine, and I did it in raw PHP, in postman I get same issue as well. As far as enabling, i'm guessing it's here: http://prntscr.com/n6enqh ? Still no dice :(
first of all, there is no problem with ebay, i am able to get a user token:
postman generates this code for me:
<?php
$request = new HttpRequest();
$request->setUrl('https://api.ebay.com/identity/v1/oauth2/token');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Postman-Token' => '784bae81-d5e6-402e-8d51-1c2c7d4220ad',
'cache-control' => 'no-cache',
'Authorization' => 'Basic xxxxxxxxxxxxxxxxxxxxxx==',
'Accept' => 'application/json',
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->setContentType('application/x-www-form-urlencoded');
$request->setPostFields(array(
'grant_type' => 'authorization_code',
'code' => 'v^1.1xxxxxxxxxxxxxxxxxx',
'redirect_uri' => 'MACxxxxxxxxxxxxxx',
'undefined' => null
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
unless you are not able to make this working with that code (or postman) you may use wrong scopes or maybe there is problem with the ebay user itself, maybe use a different ebay-account (for login) to be sure that your problem is not related to that specific ebay user you are dealing with right now.
i also tested with my playground a little bit a got confusing results, i also got several times a "bad request", i just called the oauth-login several times again, and after 6 or 7 tries, i got my access token:
maybe ebay has issues here, i don´t know 🤔
when you play with my "playground" you can add "dumps" inside the function \League\OAuth2\Client\Provider\AbstractProvider::getParsedResponse
to see the request and the response, that helps debugging:
public function getParsedResponse(RequestInterface $request)
{
try {
dump($request);
dump((string)$request->getBody());
$response = $this->getResponse($request);
dump($response);
dump((string)$response->getBody());
} catch (BadResponseException $e) {
$response = $e->getResponse();
}
$parsed = $this->parseResponse($response);
$this->checkResponse($response, $parsed);
return $parsed;
}
In my case, Time will solve everything
I've been at this for days, including a stand alone curl script( https://stackoverflow.com/questions/55412803/ebay-api-always-returning-invalid-client-on-production-but-sandbox-works-fine ) and by using this SDK I thought i'd finally win this battle ,
Seems like the SDK would be best bet, but i'm once again getting the same issue, I've hacked together this code, after many hours of editing it and testing all sorts of different things, but hopefully someone can point me in the right direction as i'm about to pull my hair out after 3 days.
So the code I have right now is:
And what ever I do, or what ever I change, I get the following:
Can someone assist? I've read so many different documentations, tried so many different samples of codes and examples and still dead stuck on this error. Interestingly enough, my stand alone sample works perfectly on sandbox, but not production..
Sorry if my post doesn't make sense, need some sleep.