Google+ API 또는 Google+ Domains API를 사용하여 사용자로부터 조직을 얻으려고합니다. 나는 공식 문서의 단계를 수행하고 내가 사용하고 논리는 이것이다 : 이것은 완벽하게 내가 Google+에 도메인에 의 전환 Google+에 전의 G-스위트 계정에 대한 작동Google Plus API로 사용자 조직 받기
<?php session_start();
require_once 'vendor/autoload.php'; //INCLUDE PHP CLIENT LIBRARY
$scopes = array(
"https://www.googleapis.com/auth/plus.profiles.read",
"https://www.googleapis.com/auth/plus.me"
);
// Create client object and set its configuraitons
$client = new Google_Client();
$client->setRedirectUri('http://' . $_SERVER['HTTP_HOST'] . '/');
$client->setAuthConfig("creds.json");
$client->addScope($scopes);
if(isset($_SESSION["access_token"])) {
$client->setAccessToken($_SESSION["access_token"]);
$service = new Google_Service_PlusDomains($client);
$me = $service->people->get('me');
var_dump($me);
echo "<br><br>*********************************************<br><br>";
$orgs = $me->getOrganizations(); // (THIS IS EMPTY!!!) ????
var_dump($orgs);
} else {
if(!isset($_GET["code"])){
$authUrl = $client->createAuthUrl();
header('Location: ' . filter_var($authUrl, FILTER_SANITIZE_URL));
} else {
$client->authenticate($_GET['code']);
$_SESSION['access_token'] = $client->getAccessToken();
$redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . '/';
header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL));
}
}
?>
합니다. 새로운 G Suite 계정에서이 동일한 스크립트를 사용하면 작동하지 않습니다. 나는 $service = new Google_Service_Plus($client);
으로 시도했으며 그 결과는 똑같습니다. 새로운 G Suite 계정에서 작동하지 않는 이유는 무엇입니까? 다른 사람이 같은 문제가 있습니까?