Хочется автоматизировать смену подписей. Есть
PHP клиент, есть
описание API для работы с этим.
Пробую так:
require_once "google-api-php-client/src/Google_Client.php";
$client = new Google_Client();
$client->setApplicationName( 'Signature creator' );
$client->setClientId( CLIENT_ID );
$client->setAccessType( 'offline_access');
$client->setAssertionCredentials(
new Google_AssertionCredentials(
SERVICE_EMAIL,
array(
'<a href="https://apps-apis.google.com/a/feeds/emailsettings/">https://apps-apis.google.com/a/feeds/emailsettings/</a>',
'<a href="https://apps-apis.google.com/a/feeds/groups/">https://apps-apis.google.com/a/feeds/groups/</a>',
'<a href="https://apps-apis.google.com/a/feeds/alias/">https://apps-apis.google.com/a/feeds/alias/</a>',
'<a href="https://apps-apis.google.com/a/feeds/user/">https://apps-apis.google.com/a/feeds/user/</a>'),
file_get_contents( KEY_FILE_PATH )
)
);
$client->setUseObjects( true );
$domain = "domen.ru";
$user = rawurlencode("user");
$req = new Google_HttpRequest("<a href="https://apps-apis.google.com/a/feeds/emailsettings/2.0/%24domain/%24user/signature">https://apps-apis.google.com/a/feeds/emailsettings/2.0/$domain/$user/signature</a>");
$resp = $client::getIo()->authenticatedRequest($req);
print "Signature:" . $resp->getResponseBody();
Выдаёт:
Signature:
You are not authorized to access this API.
Error 403
В безопасности домена для CLIENT_ID добавил:
<a href="https://apps-apis.google.com/a/feeds/alias/">https://apps-apis.google.com/a/feeds/alias/</a>
<a href="https://apps-apis.google.com/a/feeds/emailsettings/">https://apps-apis.google.com/a/feeds/emailsettings/</a>
Groups Provisioning <a href="https://apps-apis.google.com/a/feeds/groups/">https://apps-apis.google.com/a/feeds/groups/</a>
User Provisioning <a href="https://apps-apis.google.com/a/feeds/user/">https://apps-apis.google.com/a/feeds/user/</a>