// Token request $data = array( 'grant_type' => 'authorization_code', 'code' => $code, ); $h = curl_init(h = curl_init($oidc_token_endpoint); curl_setopt($h, CURLOPT_RETURNTRANSFER, true); curl_setopt($h, CURLOPT_TIMEOUT, 10); curl_setopt($h, CURLOPT_USERPWD, "{$client_id}:{$client_secret}"); curl_setopt($h, CURLOPT_POST, true); curl_setopt($h, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); curl_setopt($h, CURLOPT_POSTFIELDS, http_build_query($data)); //curl_setopt($h, CURLOPT_SSL_VERIFYPEER, false); $res1 = curl_exec($h); $errorc1 = curl_error($h); curl_close($h);