asp.net mvc - Google Directory API Returning "403 - Insufficient Permission" error when trying to execute request to obtain GROUPS -
actual error message:
unhandled exception: google.googleapiexception: google.apis.requests.requesterror insufficient permission [403] errors [ message[insufficient permission] location[ - ] reason[insufficientpermissions] domain[global] ]
it throws error when try access groups. can obtain users fine. here code:
private static readonly int maxresultsreturned = 500; private static readonly string applicationname = "directory api .net quickstart"; private static readonly string[] scopes = { directoryservice.scope.admindirectoryuserreadonly, directoryservice.scope.admindirectorygroupreadonly }; public static void getgroups() { var service = setupservice(); // define parameters of request. var request = service.groups.list(); request.customer = "my_customer"; request.maxresults = maxresultsreturned; ilist<group> groups = request.execute().groupsvalue; //error thrown here foreach (group groupitem in groups) { console.writeline("{0}", groupitem); } }
error thrown when calling ilist<group> groups = request.execute().groupsvalue;
is there i'm missing? tried including of scopes directoryservice
holds, still getting same error.
anyone have input?
in addition having right scope user impersonating (if using service account) or running script must have rights set in admin console. may case, me couple of days ago.
Comments
Post a Comment