I am using connect id to deal with rstudio login. After retreiving the code The API returns an error:{"error":"invalid_grant","error_description":"grant request is invalid"} and i have no idea why:
$ch=curl_init();
$header = array('Authorization: Basic '.base64_encode($client_id.':'.$secret), 'Content-Type: application/x-www-form-urlencoded');
$post = array('grant_type' => 'authorization_code',
'code' => $code,
'redirect_uri' => 'MY_URL');
$url = "https://eif-til.onelogin.com/oidc/token";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
$result = curl_exec($ch);
All the variables entered seems fine, the authorisation code received seems fine and is passed as is. On Onelogin side everything seems configured as it should. My suspicion is on the PHP Curl code but I don't know what is missing/wrong