I am following a documentation for eBay API and I have done previous steps by enabling OAuth in eBay app for developer. I have got authorization but I can’t exchange it for access token. It keep showing me following error:
<code>{
"error": "server_error",
"error_description": "server encountered an unexpected condition that prevented it from fulfilling the request"
}
</code>
<code>{
"error": "server_error",
"error_description": "server encountered an unexpected condition that prevented it from fulfilling the request"
}
</code>
{
"error": "server_error",
"error_description": "server encountered an unexpected condition that prevented it from fulfilling the request"
}
I have tried running this in my PHP Laravel Controller and in Postman. Getting same error:
<code>$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.sandbox.ebay.com/identity/v1/oauth2/token',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'grant_type=authorization_code& code=v%5E1.1%23i%5E1%23p%5E3%23f%5E0%23I%5E3%23r%5E1%23t%5EUl41XzM6RURBMkI0QkQ3RDZGNzVBNzY3RTRFQjUwODk3REE3QzVfMF8xI0VeMTI4NA%3D%3D&redirect_uri=Muhammad_Tayyab-Muhammad-OTIFTE-epcga',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Basic CXVoYW1tYWQtT1RJRlRFU1QtU0JYLWNhYzMyODgwMi02ODMwYjc1YzpTQlgtYWMzMjg4MDI1Yjk1LTdjOGQtNDgyMC1iMjQ1LTlmNWQ=',
'Cookie: dp1=bu1p/QEBfX0BAX19AQA**69fc443e^; ebay=%5Esbf%3D%23%5E'
),
));
$response = curl_exec($curl);
curl_close($curl);
</code>
<code>$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.sandbox.ebay.com/identity/v1/oauth2/token',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'grant_type=authorization_code& code=v%5E1.1%23i%5E1%23p%5E3%23f%5E0%23I%5E3%23r%5E1%23t%5EUl41XzM6RURBMkI0QkQ3RDZGNzVBNzY3RTRFQjUwODk3REE3QzVfMF8xI0VeMTI4NA%3D%3D&redirect_uri=Muhammad_Tayyab-Muhammad-OTIFTE-epcga',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Basic CXVoYW1tYWQtT1RJRlRFU1QtU0JYLWNhYzMyODgwMi02ODMwYjc1YzpTQlgtYWMzMjg4MDI1Yjk1LTdjOGQtNDgyMC1iMjQ1LTlmNWQ=',
'Cookie: dp1=bu1p/QEBfX0BAX19AQA**69fc443e^; ebay=%5Esbf%3D%23%5E'
),
));
$response = curl_exec($curl);
curl_close($curl);
</code>
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.sandbox.ebay.com/identity/v1/oauth2/token',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'grant_type=authorization_code& code=v%5E1.1%23i%5E1%23p%5E3%23f%5E0%23I%5E3%23r%5E1%23t%5EUl41XzM6RURBMkI0QkQ3RDZGNzVBNzY3RTRFQjUwODk3REE3QzVfMF8xI0VeMTI4NA%3D%3D&redirect_uri=Muhammad_Tayyab-Muhammad-OTIFTE-epcga',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Basic CXVoYW1tYWQtT1RJRlRFU1QtU0JYLWNhYzMyODgwMi02ODMwYjc1YzpTQlgtYWMzMjg4MDI1Yjk1LTdjOGQtNDgyMC1iMjQ1LTlmNWQ=',
'Cookie: dp1=bu1p/QEBfX0BAX19AQA**69fc443e^; ebay=%5Esbf%3D%23%5E'
),
));
$response = curl_exec($curl);
curl_close($curl);
Link to the doc:
https://developer.ebay.com/api-docs/static/oauth-auth-code-grant-request.html
I don’t know what I am doing wrong here. I can’t find official postman collection for ebay API.