I'm including this into my html5 app (reduced down)
<script>
function load() {
gapi.client.setApiKey('API_KEY');
gapi.auth.authorize({client_id: 'CLIENT_ID',
scope: 'https://www.googleapis.com/auth/admin.directory.user https://www.googleapis.com/auth/admin.directory.user.readonly'
}, function(){
gapi.client.load('admin', 'directory_v1', function() {
// Step 5: Assemble the API request
console.log(gapi.client);
var request = gapi.client.directory.users.list({
customer: "my_customer"
});
// Step 6: Execute the API request
request.execute(function(resp) {
console.log('RESPONSE', resp);
});
});
});
}
</script>
<script src="https://apis.google.com/js/client.js?onload=load"></script>
I want to access the directory within my google apps account - When I do this using the google api explorer I can get back all of the information I require but doing it via the google api javascript client (which I know is still in beta) I get back an error from the rpc:
[{"error":{"code":404,"message":"Not Found","data":[{"domain":"global","reason":"notFound","message":"Not Found"},{"domain":"global","reason":"internalError","message":"Internal Error"}]},"id":"gapiRpc"}]
But I know I have the right credentials/scopes etc as the discovery call gives me back this result:
{"methods":{"directory.chromeosdevices.get":{"id":"directory.chromeosdevices.get"},"directory.chromeosdevices.list":{"id":"directory.chromeosdevices.list"},"directory.chromeosdevices.patch":{"id":"directory.chromeosdevices.patch"},"directory.chromeosdevices.update":{"id":"directory.chromeosdevices.update"},"directory.groups.aliases.delete":{"id":"directory.groups.aliases.delete"},"directory.groups.aliases.insert":{"id":"directory.groups.aliases.insert"},"directory.groups.aliases.list":{"id":"directory.groups.aliases.list"},"directory.groups.delete":{"id":"directory.groups.delete"},"directory.groups.get":{"id":"directory.groups.get"},"directory.groups.insert":{"id":"directory.groups.insert"},"directory.groups.list":{"id":"directory.groups.list"},"directory.groups.patch":{"id":"directory.groups.patch"},"directory.groups.update":{"id":"directory.groups.update"},"directory.members.delete":{"id":"directory.members.delete"},"directory.members.get":{"id":"directory.members.get"},"directory.members.insert":{"id":"directory.members.insert"},"directory.members.list":{"id":"directory.members.list"},"directory.members.patch":{"id":"directory.members.patch"},"directory.members.update":{"id":"directory.members.update"},"directory.mobiledevices.action":{"id":"directory.mobiledevices.action"},"directory.mobiledevices.delete":{"id":"directory.mobiledevices.delete"},"directory.mobiledevices.get":{"id":"directory.mobiledevices.get"},"directory.mobiledevices.list":{"id":"directory.mobiledevices.list"},"directory.orgunits.delete":{"id":"directory.orgunits.delete"},"directory.orgunits.get":{"id":"directory.orgunits.get"},"directory.orgunits.insert":{"id":"directory.orgunits.insert"},"directory.orgunits.list":{"id":"directory.orgunits.list"},"directory.orgunits.patch":{"id":"directory.orgunits.patch"},"directory.orgunits.update":{"id":"directory.orgunits.update"},"directory.users.aliases.delete":{"id":"directory.users.aliases.delete"},"directory.users.aliases.insert":{"id":"directory.users.aliases.insert"},"directory.users.aliases.list":{"id":"directory.users.aliases.list"},"directory.users.delete":{"id":"directory.users.delete"},"directory.users.get":{"id":"directory.users.get"},"directory.users.insert":{"id":"directory.users.insert"},"directory.users.list":{"id":"directory.users.list"},"directory.users.makeAdmin":{"id":"directory.users.makeAdmin"},"directory.users.patch":{"id":"directory.users.patch"},"directory.users.photos.delete":{"id":"directory.users.photos.delete"},"directory.users.photos.get":{"id":"directory.users.photos.get"},"directory.users.photos.patch":{"id":"directory.users.photos.patch"},"directory.users.photos.update":{"id":"directory.users.photos.update"},"directory.users.undelete":{"id":"directory.users.undelete"},"directory.users.update":{"id":"directory.users.update"}}}
Can anyone tell em what I'm doing wrong? I can't see that I'm doing anything wrong, I'm sending the customer parameter, and using the right function within the object in gapi.client
, it's getting loaded into gapi.client
as I can see it available to me, it's just erroring when returning