I am attempting to use the PHP Coinbase API. I already have an API key and OAuth key. I already set up my web server. Also, I already downloaded the library on GitHub but I still cannot make it work.
Every time I use this code it returns:
string(213) "{"error":"invalid_grant","error_description":"The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}"
Relevant Code
$post = [
'grant_type' => 'authorization_code',
'code' => 'xxxxxx',
'client_id' => 'xxxxx',
'client_secret' => 'xxxx',
'redirect_uri' => 'https://sample/mybots/blockchain',
];
$ch = curl_init('https://api.coinbase.com/oauth/token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
// execute!
$response = curl_exec($ch);
// close the connection, release resources used
curl_close($ch);
// do anything you want with your response
var_dump($response)