Hawk HR allows the admin to synchronize the employee leave calendar with Google calendar. Refer the steps below for the configurations you need to enable:
- Create Service account
- Delegate Domain-wide authority to the service account
- Upload the JSon file.
Create a Service account:
The Google OAuth system supports server-to-server interactions such as those between a web application and a Google service. For this scenario, you need a service account, which is an account that belongs to your application instead of to an individual end-user. Your application calls Google APIs on behalf of the service account, so users aren't directly involved.
- A service account's credentials include a generated email address that is unique and at least one public/private key pair. If domain-wide delegation is enabled, then a client ID is also part of the service account's credentials.
- Open the Service Account Page and select a project from the top bar.
- Click on " +Create Service Account", and Enter the name and description for the service account. You can use the default service account ID, or choose a different, unique one. When done click Create button.
- Next, you would get the option to update account permissions. The Service account permissions is an Optional section. You ignore the same and click on Continue button.
- A new page opens up, with the title "Grant users access to this service account screen ", scroll down the page to the Create key section. Click Create key.
- In the side panel, select the format for your key: JSON (recommended).
- Click on the Create button. Your new public/private key pair is generated and downloaded to your machine; it serves as the only copy of this key.
Grant G Suite domain-wide authority to the service account.
- Now locate the newly-created service account in the table. Under the Actions section, click on the Edit option.
- In the service account details, click on Show domain-wide delegation, and ensure the Enable G Suite Domain-wide Delegation checkbox is enabled.
- If you haven't yet configured your app's OAuth consent screen, you must do so before you can enable domain-wide delegation. Follow the on-screen instructions to configure the OAuth consent screen, then repeat the above steps and re-check the checkbox.
- Click on Save button to update the service account, and return to the table of service accounts. A new column, Domain-wide delegation, can be seen. Click View Client ID, to obtain and make a note of the client ID.
Delegate Domain-wide authority to the service account:
Now as an administrator of the G Suite domain, you need to complete the following steps:
- Go to your G Suite domain’s Admin console.
- Select Security from the list of controls. If you don't see Security listed, select More controls from the gray bar at the bottom of the page, then select Security from the list of controls. If you can't see the controls, make sure you're signed in as an administrator for the domain.
- Select Show more and then Advanced settings from the list of options.
- Select Manage API client access in the Authentication section.
- In the Client Name field enter the service account's Client ID. You can find your service account's client ID in the Service accounts page.
- In the One or More API Scopes field enter the list of scopes that your application should be granted access to. For example, if your application needs domain-wide access to the Google Drive API and the Google Calendar API, enter https://www.googleapis.com/aut....
- Click Authorize.
Note:
- Kindly note the Google Calendar API has to be enabled for the project.
- Kindly enable the same by visiting the link:https://console.developers.google.com/apis/api/calendar-json.googleapis.com/overview?project= ID and then retry.
- Enter the ID number in the end of the link: :https://console.developers.google.com/apis/api/calendar-json.googleapis.com/overview?project= ID
- Kindly, wait a few minutes for the action to propagate to our systems and then check the status
Upload the JSON file :
The file you get while "Creating the Service account", you will have to upload the file on the link shared by the Hawk HR team.
Output :
The leaves when applied by the employee and approved by the reporting manager, will populate the Approved leaves on the employee and direct reporting managers' Google calendar.