I have written the following code which permits me to supply my login-credentials to the eBay account login page, but fails to raise a user-token with an 'Internal Server Error (500)' error:
$clientId = env('EBAY_APP_ID');
$clientSecret = env('EBAY_CERT_ID');
$credentials = base64_encode("{$clientId}:{$clientSecret}");
$response = Http::withHeaders([
'Content-Type' => 'application/x-www-form-urlencoded',
'Accept' => 'application/json',
'Authorization' => "Basic {$credentials}",
])->asForm()->post('https://api.sandbox.ebay.com/identity/v1/oauth2/token', [
'client_id' => env('EBAY_APP_ID'),
'client_secret' => env('EBAY_CERT_ID'),
'grant_type' => 'authorization_code',
'code' => $request->code,
'redirect_uri' => env('EBAY_RU_NAME'),
]);
I am able to get $request->code after successfull ebay login and i receive this error
Illuminate\Http\Client\Response {#311 ▼ #response: GuzzleHttp\Psr7\Response {#347 ▼ -reasonPhrase: "Internal Server Error" -statusCode: 500 -headers: array:15 [▶] -headerNames: array:15 [▶] -protocol: "1.1" -stream: GuzzleHttp\Psr7\Stream {#344 ▶} } #decoded: null +"cookies": GuzzleHttp\Cookie\CookieJar {#328 ▶} +"transferStats": GuzzleHttp\TransferStats {#348 ▶}
In my returnURL function, I have this:
I was trying to get the user-token to access the eBay RESTful API