question

fun-club avatar image
0 Likes"
fun-club asked ·

error OAuth RestApi Please help


I have a Problem with OAuth RestApi.


when I send the request via OAuth Restapi, I get this error.


here you can find my request and response.

my code always worked, so now i don't know where this error is, can you please help me



Request

$curl = curl_init();


curl_setopt_array($curl, [

CURLOPT_URL => 'https://api.ebay.com/identity/v1/oauth2/token',

CURLOPT_RETURNTRANSFER => true,

CURLOPT_ENCODING => "",

CURLOPT_MAXREDIRS => 10,

CURLOPT_TIMEOUT => 30,

CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

CURLOPT_CUSTOMREQUEST => "POST",

CURLOPT_POSTFIELDS => "grant_type=authorization_code&code=*****&redirect_uri=https%3A%2F%2Fsamurai-team%2FEbayGetTokenOauth.php",

CURLOPT_COOKIE => "ebay=%255Esbf%253D%2523%255E; dp1=bu1p%2FQEBfX0BAX19AQA**63f5eac0%5E",

CURLOPT_HTTPHEADER => [

"Authorization : Basic ******",

"Content-Type: application/x-www-form-urlencoded"

],

]);


$response = curl_exec($curl);

$err = curl_error($curl);


curl_close($curl);


if ($err) {

echo "cURL Error #:" . $err;

} else {

echo $response;

}


Response:

Array

(

[error] => invalid_request

[error_description] => request is missing a required parameter or malformed.

)

generate token
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.

fun-club avatar image
0 Likes"
fun-club answered ·

I found the error. it was the space between Authorization and :

"Authorization : Basic ******"

· Share
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.

things4craft avatar image
0 Likes"
things4craft answered ·

Cant see anything wrong although you uri redirect goes to 404 page, maybe thats it.

· Share
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.

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.