Preparing Gmail Account

To configure your company Gmail for AGSync Gmail administrator should complete a number of steps. We need to create special account that is able to provide API access and impersonate as all users involved in the sync process. This account is accessed via special API access keys.

Step 1

Log into the Google Developers console as Google apps domain administrator.

So go to https://console.developers.google.com/projectselector/permissions/serviceaccounts

Create a project. We recommend you to call the project “AGSync”

And press “Create”. This may take a while:

Finally list of service accounts appears:

New service account with unique name (in this case it is: agsync-1248@appspot.gserviceaccount.com ) has been created.

Step 2

Now define which APIs may be accessed by given service account. Go to API Manager (Home->API Manager):

You need to enable following 4 APIs: Calendar API, Contacts API, Gmail API and Tasks API as follows:

Tasks API is not available in the default list, but may be easily found by search:

Finally the list of enabled APIs should at least contain following 4 items:

Step 3

Now you need to create access credentials for the service account. Go to “Credentials” and click “Create credentials:”

From the list choose “Service account key”:

From “Service account” dropdown:

Choose key name (i.e. “agsync”) and key type “P12”:

It is working for a while:

And then suggests to download a file:

You need to save it somewhere – it will later be needed to configure AGSync connection.

You should see the list of available service accounts:

Also you need to write down service account email address – it will be needed later. I.e. in our case it is: agsync@agsync-1248.iam.gserviceaccount.com

Now we need to enable delegation for new service account. From the context menu:

Choose “Edit”:

Tick “Enable Google Apps Domain-wide Delegation” checkbox and define product name for consent screen (i.e. agsync).

After pressing “Save” we have option to “View Client ID” – click on it to use later:

Now copy Client ID for later use (in our case it is 117366045824231318166):

And press “Save”.

So, as a result of this step we recorded two things:

  1. Service Account email address: agsync@agsync-1248.iam.gserviceaccount.com

  2. Client ID: 117366045824231318166

  3. Downloaded file AGSync-39fd28b66b40.p12 saved to desktop.

We will need them later.

Step 4

Now go back to Admin console:

https://admin.google.com/AdminHome

Choose “Security”:

Scroll down and choose “Show More”:

Now choose “Advanced Settings”:

“Manage API client access”:

Now add authorized API client as follows:

Set “Client Name” to the Client ID (that you got at the end of the Step 3),

One or More APi Scopes should contain the following text:

https://www.googleapis.com/auth/calendar,https://www.googleapis.com/auth/tasks,https://www.google.com/m8/feeds,https://www.googleapis.com/auth/gmail.modify,https://www.googleapis.com/auth/userinfo.profile

Finally, press “Authorize”. If everything is OK then Authorized API client now appears in the list:

Step 5

Final step is to use collected information in the AGSync connection settings.

All we need for connection is Service account email and an Account Key collected on the Step 3: