Get All Users in Google Apps Domain After Installing App from Google Apps Marketplace

310 Views Asked by At

My client is a SAAS software provider. He has an app available in the Google Apps Marketplace. The customer may add the Marketplace app to his domain. The Marketplace listing provides us with a consumer key and consumer secret, which we have integrated in our SAAS product.

The customers that have installed our app should theoretically be able to synchronize the users from THEIR Google Apps domain to his SAAS installation using the consumer key/secret pair we have from the Marketplace listing and configured in the SAAS product.

We are currently using the following, but it does not work. The API call returns "401 Unknown authorization header".

require_once $gapps_vendors_dir . '/Zend/Oauth/Consumer.php';
require_once $gapps_vendors_dir . '/Zend/Gdata/Gapps/UserEntry.php';
require_once $gapps_vendors_dir . '/Zend/Gdata/Gapps/UserFeed.php';
require_once $gapps_vendors_dir . '/Zend/Gdata/Gapps/UserQuery.php';

$options = array(
    'requestScheme' => Zend_Oauth::REQUEST_SCHEME_HEADER,
    'version' => '1.0',
    'signatureMethod' => 'HMAC-SHA1',
    'consumerKey' => $CONSUMER_KEY,
    'consumerSecret' => $CONSUMER_SECRET,
);


$token = new Zend_Oauth_Token_Access();
$httpClient = $token->getHttpClient($options);

$gdata = new Zend_Gdata_Gapps($httpClient, $clientsDomain);

$feed = $gdata->retrieveAllUsers();
0

There are 0 best solutions below