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.
Log into the Google API Console.
Click Create Project or select an existing project.
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.
Click Create. The OAuthClientId and OAuthClientSecret are displayed.
Click Library -> Google Calendar API -> Enable API.
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.
Log into the Google API Console and open a project. Select the API Manager from the main menu.
Click Create Credentials -> Service Account Key.
In the Service Account menu, select New Service Account or select an existing service account.
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.
In the Key Type section, select the P12 key type.
Create the app to download the key pair. The private key's password is displayed: Set this in OAuthJWTCertPassword.
In the service accounts section, click Manage Service Accounts and set OAuthJWTIssuer to the email address displayed in the service account Id field.
Click Library -> Google Calendar API -> Enable API.
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".
When you connect the provider completes the OAuth flow for a service account.
Creates and signs the JWT with the claim set required by the provider.
Exchanges the JWT for the access token.
Saves OAuth values in OAuthSettingsLocation to be persisted across connections.
Submits the JWT for a new access token when the token expires.
GoogleContacts uses the OAuth authentication standard. You can use OAuth to authorize the provider to access Google APIs on behalf of individual users or on behalf of users in a domain.
The user account flow requires the authenticating user to interact with GoogleContacts via the browser.
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. You can then connect to GoogleContacts data that the service account has permission to access.
To obtain an OAuthAccessToken, you need to register an app and set the following connection properties.
OAuthClientId: Set this to the client Id in your app settings.
OAuthClientSecret: Set this to the client secret in your app settings.
You can use a service account in this OAuth flow to access Google APIs on behalf of users in a domain. A domain administrator must delegate domain-wide access to the service account.
To complete the service account flow, you need to generate a private key in the Google APIs Console. In the service account flow, the provider obtains an OAuthAccessToken to authenticate that it has the same scope of access to Google APIs as the service account. The provider exchanges a JSON Web token (JWT) to obtain the access token. The private key is required to sign the JWT.
If you are connecting from a service account, follow the steps below:
Log into the Google API Console and open a project. Select the API Manager from the main menu.
Click Credentials -> Create Credentials -> Service Account Key.
In the Service Account menu, select New Service Account or select an existing service account.
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.
In the Key Type section, select the P12 key type.
Download the key pair. The private key's password is displayed: Set this in OAuthJWTCertPassword.
In the Service Account Keys section on the Credentials page, click Manage Service Accounts and set OAuthJWTIssuer to the email address displayed in service account Id.
In the API Manager, click Library and enable the Drive, Calendar, and Contacts APIs. To enable an API, click the API and then click Enable API.
After setting the following connection properties, you are ready to connect:
InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken connection property.
OAuthJWTCertType: Set this to "PFXFILE".
OAuthJWTCertPassword: Set this to the password of the .p12 file.
OAuthJWTCertSubject: Set this to "*" to pick the first certificate in the certificate store.
OAuthJWTIssuer: Set this to the email address of the service account.
OAuthJWTCert: Set this to the path to the .p12 file.
OAuthJWTSubject: Set this to the email address of the user for whom the application is requesting delegate access.
When you connect the provider completes the OAuth flow for a service account:
Creates and signs the JWT with the claim set required by the provider.
Exchanges the JWT for the access token.
Submits the JWT for a new access token when the token expires.