I have a project that runs in CI3 and he need's to connect in Laravel 5.5 API with OAUTH2.
Now my current code in codeigniter is this:
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url_api);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, array(
'login' => $login,
'Accept' => 'application/json',
'Authorization' => 'Bearer '.APP_ACCESSTOKEN
));
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
$result = json_decode($buffer);
if(isset($result->status) && $result->status == 'success')
{
echo 'User has been updated.';
}
else
{
echo 'Something has gone wrong '.$url_api .'<br>?'.$result.'<br>';
}
exit;
I have no idea of how to send login and token on this get request. Can someone give me an example? It's not authenticating. However, if I remove the route from auth, it work's fine, so its auth problem.
I searched a lot, but no success :(
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire