I was already checking other threads with the same error and still couldn't fix it.
So here is my PHP code:
$data = [
"client_id" => "id-here",
"client_secret" => "secret-here",
"refresh_token" => "refresh-token-here",
"grant_type" => "refresh_token"
];
$ch = curl_init( 'https://www.googleapis.com/oauth2/v4/token' );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/x-www-form-urlencoded'));
curl_setopt( $ch, CURLOPT_POSTFIELDS, $data );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$result = curl_exec($ch);
curl_close($ch);
dd($result);
As you can see I do have the "application/x-www-form-urlencoded" included, yet I still get a response:
{
"error": "unsupported_grant_type",
"error_description": "Invalid grant_type: "
}
I hope that someone will be able to help. Any tips, links, or code-snippets will do! Thank you!