1

With Google Drive APIs, I am able to initalize DriveService Object using OAuth2.0, but don't know how to initialize AppsService object of Google Provisioning API to work with Domain Gorups and Users. I tried

AppsService _appService = new AppsService("DOMAINNAME", "AuthenticationTokenFromDriveServiceObj");

But, getting "Invalide Token" exception.

  1. It looks like Google Provisioning APIs are still not able to handle Google Drive APIs. am I correct here?
  2. Are Google Provisioning APIs are deprecated by Google? refer link https://developers.google.com/google-apps/admin-api-deprecation-list

Edited:

I am getting Drive service Object from the code given at: https://developers.google.com/drive/delegation#instantiate_a_drive_service_object [Here, I tried adding provisioning API scopes also] And then

PermissionList permissions = _DriveSevice.Permissions.List("root").Fetch();
string userName = permissions.Items[0].Name;
string authenticationToken = auth.State.AccessToken;
AppsService _AppService = new AppsService("DOMAINNAME", authenticationToken);
_AppsService.RetrieveAllUsers(); //This statement errors out
Jeevan
  • 167
  • 2
  • 11

2 Answers2

0

You just need to use the setOauth2Credentials with the Oauth2 credentials used to instanciate your Drive instance on your apps service instance, provided of course that your token is valid for scopes of Drive and Provisioning API.

Here are the Oauth2 scopes for the provisioning API

Jerome
  • 2,104
  • 1
  • 17
  • 31
  • I have tried with all scopes of Drive and Provisioning APIs separated by Space but still getting Unauthorized error. – Jeevan Dec 11 '12 at 14:19
  • Could you update your question with the code you use to get your token ? – Jerome Dec 11 '12 at 14:50
-2

The Drive API and Provisioning API are scoped differently and can't share OAuth credentials. You need to go through the OAuth flow for the Provisioning API separately, they are completely unrelated APIs.

The Provisioning API has not been deprecated. That list is for APIs subject to the deprecation policy, which is posted at https://developers.google.com/google-apps/admin-api-terms.

hexedpackets
  • 854
  • 10
  • 16
  • 1
    You are correct that they are scoped differently but there's no need to push users through 2 auth workflows. You just need to put a space between the 2 scopes when making the request. – Jay Lee Dec 10 '12 at 18:03