$response = Http::withHeaders([
'Authorization' => 'Basic '. base64_encode(env('CLIENT_ID').':'.env('CLIENT_SECRET')),
'Content-Type' => 'application/x-www-form-urlencoded'
])->post('https://accounts.spotify.com/api/token', [
'code' => trim($code),
'redirect_uri' => env('REDIRECT_URI'),
'grant_type' => 'authorization_code',
]);
print_r($response->json());
Этот код возврата:
[error] => unsupported_grant_type [error_description] => параметр grant_type отсутствует, когда я хочу получить токен доступа.