Php 群组RESTful API无法连接
我试图在我的网站中使用群组身份验证,但我一直发现401应用程序无法进行身份验证。我不知道为什么,因为我正确地传递了应用程序用户名和密码。我所拥有的:Php 群组RESTful API无法连接,php,rest,atlassian-crowd,Php,Rest,Atlassian Crowd,我试图在我的网站中使用群组身份验证,但我一直发现401应用程序无法进行身份验证。我不知道为什么,因为我正确地传递了应用程序用户名和密码。我所拥有的: $data = array("value" => "APP_PASS"); $data_string = json_encode($data); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://PATH:8095/crowd/rest/usermanagement/2/au
$data = array("value" => "APP_PASS");
$data_string = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://PATH:8095/crowd/rest/usermanagement/2/authentication?username=APP_NAME');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string),
'Accept: application/json'
)
);
$output = curl_exec($ch);
echo $output;
curl_close($ch);
您需要为您的应用程序user:password使用CURLOPT_HTTPAUTH和CURLOPT_USERPWD。群组将ACL用于请求的应用程序以及您请求的用户身份验证
curl -i -u 'APP_USER:APP_PASS' --data '{"value": "USER_PASS"}' https://SERVER_URL/crowd/rest/usermanagement/1/authentication?username=USER_ID --header 'Content-Type: application/json' --header 'Accept: application/json'
401表示凭证未经授权或不正确。您确定用户名和密码正确吗?考虑到群组API,您的请求在语法上似乎是正确的。@OhAuth我已经尝试了所有用户,并通过了验证