Why do I keep getting unsupported_grant_type when using oAuth2 and curl? Why do I keep getting unsupported_grant_type when using oAuth2 and curl? curl curl

Why do I keep getting unsupported_grant_type when using oAuth2 and curl?


This is not how to add POST data to cURL. There is PHP documentation to tell you what these options actually mean. Try this instead:

<?php$postdata = [    "client_secret"=>"xxx",    "client_id"=>"xxx",    "grant_type"=>"client_credentials",    "scope"=>"delivery",];$cl = curl_init("https://login.uber.com/oauth/v2/token");curl_setopt_array($cl, [    CURLOPT_POST           => true,    CURLOPT_POSTFIELDS     => $postdata,    CURLOPT_RETURNTRANSFER => true]);$content = curl_exec($cl);curl_close($cl);var_dump($content);


This answer is also very useful if the above answer doesn't work: Curl Grant_Type not found FIXED.