Search code examples
google-calendar-apigoogle-workspaceservice-accounts

Google Calendar API: how to add freebusy permission to user's calendar?


In my web app I need to add freebusy read permission for my service account to the primary calendar of gmail addresses provided by users.

How do I do that?


Solution

  • Delegate domain-wide authority to your service account

    1. From your domain’s Admin console, go to Main menu menu > Security > Access and data control > API controls.
    2. In the Domain wide delegation pane, select Manage Domain Wide Delegation.
    3. Click Add new.
    4. In the Client ID field, enter the client ID obtained from the service account creation steps above.
    5. In the OAuth Scopes field, enter a comma-delimited list of the scopes required for your application. Use the scope https://www.googleapis.com/auth/calendar for full access to the Google Calendar API.
    6. Click Authorize.