> For the complete documentation index, see [llms.txt](https://docs.appstrategy.com/apprules-r-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appstrategy.com/apprules-r-documentation/platform/platform-features/system-settings/data-sources/connection-settings/calendarsandcontactmgrs/googlecalendar.md).

# Google Calendar

&#x20;Use the OAuth authentication standard to connect to Google Calendar. You can authenticate with a user account or with a service account. A service account is required to grant organization-wide access scopes to the provider. The provider facilitates these authentication flows as described below.

#### Authenticate with a User Account

1. Log into the Google API Console.
2. Click Create Project or select an existing project.
3. In the API Manager, click Credentials -> Create Credentials -> OAuth Client Id -> Web Application. In the Authorized Redirect URIs box, enter the URL you want to be used as a trusted redirect URL, where the user will return with the token that verifies that they have granted your app access.
4. Click Create. The OAuthClientId and OAuthClientSecret are displayed.
5. Click Library -> Google Calendar API -> Enable API.

#### Authenticate with a Service Account

Service accounts have silent authentication, without user authentication in the browser. You can also use a service account to delegate enterprise-wide access scopes to the provider.

You need to create an OAuth application in this flow.&#x20;

1. Log into the Google API Console and open a project. Select the API Manager from the main menu.
2. Click Create Credentials -> Service Account Key.
3. In the Service Account menu, select New Service Account or select an existing service account.
4. If you are creating a new service account, additionally select one or more roles. You can assign primitive roles at the project level in the IAM and Admin section; other roles enable you to further customize access to Google APIs.
5. In the Key Type section, select the P12 key type.
6. Create the app to download the key pair. The private key's password is displayed: Set this in OAuthJWTCertPassword.
7. In the service accounts section, click Manage Service Accounts and set OAuthJWTIssuer to the email address displayed in the service account Id field.
8. Click Library -> Google Calendar API -> Enable API.

&#x20;You can then connect to Google Calendar data that the service account has permission to access.

After setting the following connection properties, you are ready to connect:

* InitiateOAuth: Set this to GETANDREFRESH.
* OAuthJWTCertType: Set this to "PFXFILE".
* OAuthJWTCert: Set this to the path to the .p12 file you generated.
* OAuthJWTCertPassword: Set this to the password of the .p12 file.
* OAuthJWTCertSubject: Set this to "\*" to pick the first certificate in the certificate store.
* OAuthJWTIssuer: In the service accounts section, click Manage Service Accounts and set this field to the email address displayed in the service account Id field.
* OAuthJWTSubject: Set this to your enterprise Id if your subject type is set to "enterprise" or your app user Id if your subject type is set to "user".

&#x20;When you connect the provider completes the OAuth flow for a service account.

1. Creates and signs the JWT with the claim set required by the provider.
2. Exchanges the JWT for the access token.
3. Saves OAuth values in OAuthSettingsLocation to be persisted across connections.
4. Submits the JWT for a new access token when the token expires.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.appstrategy.com/apprules-r-documentation/platform/platform-features/system-settings/data-sources/connection-settings/calendarsandcontactmgrs/googlecalendar.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
