Zimbra Tech Skillz: Sync Your Gmail and Zimbra Calendars

Many thanks to Carlos Pineda, Senior Solutions Advisor at Zimbra, for this post!

Did you know that you can sync your Gmail calendar to your Zimbra account? This means that you can see your Zimbra events in your Gmail calendar AND your Gmail events in your Zimbra calendar. Any change you make to one calendar will sync to the other including new events, updates to events, and deleted events.

There are steps to perform in Google, on the Zimbra server and in the Zimbra Web Client. Let’s start with the steps in Google.

Steps in Google

1. Create a Project in the Google Developer Console.

Google APIs use the OAuth 2.0 protocol for authentication and authorisation. Google supports common OAuth 2.0 scenarios such as those for web server, installed and client-side applications. So to sync the calendar, you need to first obtain OAuth 2.0 client credentials from the Google API Console. Then your client application requests an access token from the Google Authorization Server, extracts a token from the response and sends the token to the Google API that you want to access.

2. Create credentials to access Google’s APIs. A client ID and client secret are required to authenticte users and gain access to Google’s APIs.

  • Specify OAuth consent screen details.

  • Create credentials specifying your ZCS environment; for example, https://mail.zimbra.io

3. Enable CalDAV API.

 

 

Steps on the ZCS Server

  1. Set zimbraOAuthConsumerAPIScope on your domain.
  2. zmprov md <your domain> zimbraOAuthConsumerAPIScope ‘https://www.googleapis.com/auth/calendar:google_caldav’

  3. Set zimbraOAuthConsumerCredentials on your domain. Specify your client id and client secret.
  4. zmprov md <your domain> zimbraOAuthConsumerCredentials <client id>:<secret>:google

  5. Set zimbraOAuthConsumerRedirectUri on your domain.
  6. zmprov md <your domain> zimbraOAuthConsumerRedirectUri ‘<hostname>/service/extension/oauth2/authenticate/google:google’

Example:

zmprov md zimbra.io zimbraOAuthConsumerRedirectUri ‘https://mail.zimbra.io/service/extension/oauth2/authenticate/google:google’

 

 

Steps in the Zimbra Web Client

  1. Login to your Zimbra Web Client.
  2. Authorize Google to visit the following URL, specifying your hostname: https://<hostname>/service/extension/oauth2/authorize/google?type=caldav
  3. Select your Gmail account, and you will see the Gmail Calendar in the Zimbra Calendar.
  4. You can create an event from Zimbra into Gmail Calendar or create an appointment in Gmail Calendar, and see it from Zimbra.

Calendar View in Zimbra

Calendar View in Gmail

Thanks for reading,

Your Zimbra Friends & Colleagues

15 Responses to Zimbra Tech Skillz: Sync Your Gmail and Zimbra Calendars

  1. MikeSysop September 21, 2018 at 8:51 PM #

    Hi There a very interesting Post as ive been looking for this however

    I am getting this error when adding attribute

    zmprov md zimbraOAuthConsumerAPIScope ‘https:/www.googleapis.com/auth/calendar:google_caldav’

    ERROR: account.INVALID_ATTR_NAME (invalid attr name: invalid attr name – unable to modify attributes: ldap host=:389: zimbraOAuthConsumerAPIScope: attribute type undefined

    Do I have to create these first and if so what are the steps?

  2. Ivan Velasco September 27, 2018 at 4:14 AM #

    I applied the first step on the ZCS Server:

    1. Set zimbraOAuthConsumerAPIScope on your domain but this error appears:

    ERROR: account.INVALID_ATTR_NAME (invalid attr name: invalid
    attr name – unable to modify attributes: zimbraOAuthConsum
    rAPIScope: attribute type undefined)

  3. Ivan Velasco September 27, 2018 at 11:12 PM #

    By applying the steps on the ZCS Server:

    1. Set zimbraOAuthConsumerAPIScope on your domain. Tthis error appears:

    ERROR: account.INVALID_ATTR_NAME (invalid attr name: invalid attr name – unable to modify attributes: zimbraOAuthConsumerAPIScope: attribute type undefined)

  4. Wong Boon Hong October 18, 2018 at 7:05 AM #

    I simply add gmail calender as external calendar into Zimbra.

  5. Peter Wilcox October 18, 2018 at 4:23 PM #

    Do you have to do the server side if each user wanted to have there own Google Sync?

  6. JSko October 22, 2018 at 9:29 AM #

    Does the same procedure work for multiple users on the same domain?

  7. Scott Bender October 23, 2018 at 9:40 PM #

    Do you need a specific version of Zimbra to do this? I am running 8.8.6 and I’m getting account.INVALID_ATTR_NAME errors:

    [zimbra@zimbra ~]$ zmprov md mydomain zimbraOAuthConsumerAPIScope ‘https://www.googleapis.com/auth/calendar:google_caldav’
    ERROR: account.INVALID_ATTR_NAME (invalid attr name: invalid attr name – unable to modify attributes: ldap host=my_server:389: zimbraOAuthConsumerAPIScope: attribute type undefined)

  8. Stephen October 25, 2018 at 12:50 AM #

    Hello,
    I’m trying to implement this but I’m running into the following error.
    zimbra@zimbra:/$ zmprov md mydomain.com zimbraOAuthConsumerAPIScope ‘https://www.googleapis.com/auth/calendar:google_caldav’
    ERROR: account.INVALID_ATTR_NAME (invalid attr name: invalid attr name – unable to modify attributes: zimbraOAuthConsumerAPIScope: attribute type undefined)

    I’m attempting this on version 8.6. Was this not implemented until a later version?

    Thanks,
    Stephen

Leave a Reply