내 목표는 내 도메인에서 모든 사용자 이메일 서명을 업데이트하는 것입니다.내 G 스위트 도메인에있는 사용자의 서명 업데이트
전 도메인 위임 권한을 가진 서비스 계정을 설정했습니다. 는하지만이 오류와 함께 붙어있어 :
{
"error": {
"errors": [
{\n
"domain": "global",
"reason": "failedPrecondition",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
나는 API 탐색기에 의해 실행 된 것보다 같은 요청을 사용하고 있습니다. 그것은 잘 포맷 된해야한다 그래서 ... API를 탐색기에서
이 제대로 나는이 대답을 보내고있어, 하나 작동하지 않습니다 : 내가 권한 문제가 있지만 내가 할 수처럼{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Delegation denied for [email protected]"
}
],
"code": 403,
"message": "Delegation denied for [email protected]"
}
}
보인다 왜 그런지 알아 내지 못 하죠.
public function updateSignAction(){
putenv('GOOGLE_APPLICATION_CREDENTIALS='.$this->get('kernel')->getRootDir().'/../app/Resources/files/mydomain.json');
$client = new \Google_Client();
$client->useApplicationDefaultCredentials();
$client->setApplicationName("demo");
$client->addScope([
"https://www.googleapis.com/auth/gmail.settings.basic",
"https://www.googleapis.com/auth/gmail.settings.sharing"
]);
//$client->setSubject('[email protected]');
$httpClient = $client->authorize();
$response = $httpClient->put(
'https://www.googleapis.com/gmail/v1/users/[email protected]/settings/sendAs/test',
[
'json' => [
'signature' => "test-via-api"
]
]
);
return $this->render('AdminBundle:GoogleApi:user/update.html.twig', array(
'response' => $response->getBody()->getContents(),
));
}
클라이언트 라이브러리를 사용하려는 경우 왜 HTTP 요청을 직접 보내고 있습니까? – DaImTo
'Google_Service_Gmail' 클래스를 사용 하시겠습니까? 나는 그것과 같은 문제가 있는데, 나는 방금 다른 방법을 시도했다. – Vivien