Hi, everyone .
I want to get email id with sugarAPI in the logic hook function.
There are two more people in the array , so I used for loop to call the API
for($i=0;$i<$count;$i++){$id=array($i);//user id in array$url="http://sugarcrm8/rest/v10/Users/$id";$ch = curl_init();$header[]="Oauth-Token:".$access_token;curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_GET,1);curl_setopt($ch, CURLOPT_HTTPHEADER, $header);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//$output = curl_exec($ch);curl_close($ch);$user_arr=json_decode($output,true);$email=$email.$user_arr['email'][0]['email_address_id'];}
It works if there is only one in array . after number one it will return
{"error":"invalid_grant","error_message":"The access token provided is invalid."}
So I get a new access_token every time in the for loop , but it didn't work .
Still get "error":"invalid_grant" ...
Thanks for watching and helping.