Google 사이트 도구 계정 (Google 앱)에서 피드를 읽으려고합니다. "Google API 콘솔"의 "서비스 계정"으로 ClientID를 만들 때 모든 사용자가 로그인하도록 내 앱을 요구하지 않아도됩니다. Google 애플 리케이션 제어판의 "Mange API 클라이언트 액세스"페이지에이 클라이언트 ID와 범위 (https://sites.google.com/feeds/)를 추가했습니다.Google 사이트 도구 API에 "서비스 계정"으로 연결
아래 코드를 사용하여 연결하면 모든 상수가 올바른 값으로 내 코드에 정의됩니다. 내 Google 애플 리케이션을 사용하여에 OAuth2.0에 놀이터 로깅이 피드를 얻을 때
// api dependencies
require_once(GOOGLE_API_PATH);
// create client object and set app name
$client = new Google_Client();
$client->setApplicationName(GOOGLE_API_NAME);
// set assertion credentials
$client->setAssertionCredentials(
new Google_AssertionCredentials(
GOOGLE_API_EMAIL,
array(GOOGLE_API_SCOPE),
file_get_contents(GOOGLE_API_PK)
));
$client->setClientId(GOOGLE_API_CLIENTID);
// create service
$req = new Google_HttpRequest("https://sites.google.com/feeds/content/<herismydomainname.com>/intranet");
$val = $client->getIo()->authenticatedRequest($req);
// The contacts api only returns XML responses.
$response = json_encode($val->getResponseBody());
print "<pre>" . print_r(json_decode($response, true), true) . "</pre>";
내가 얻을 응답은 "이 피드에 액세스 할 수있는 권한이 없습니다"입니다 내가 예상 응답을 차지하고있다. 여기에서 무엇을 내려다 볼 수 있습니까?