Enabling Links to Google Drive Documents
Liferay supports Google Drive in Documents and Media. When enabled, you can create shortcuts to your Google Drive files that enable you to view and manage them via Documents and Media.
To use this functionality in Liferay DXP 7.4, you must set up your Google project and configure Liferay’s Documents and Media application. For older versions, you must first access Liferay’s Marketplace plugins that are available for both Liferay Portal CE and Liferay DXP systems. See Installing Apps for how to install the Liferay Plugin for Google Drive.
Setting Up Your Google Project
Enabling the Liferay plugin requires an active Google Project with both the Google Drive API and Google Picker API enabled. The Google Drive API allows users to view and edit Google files (i.e., Docs, Sheets, and Slides) in their native editors. The Picker API allows users to view and select from digital assets (e.g., photos, videos, documents) stored in Google Drive when uploading files to Documents and Media. If you haven’t created a Project yet, see Creating a Google Project. Otherwise, see Enabling APIs to learn how to enable the Picker API for your project.
If desired, you can enable the creation and editing of Google documents via Documents and Media apart from the Liferay Plugin for Google Drive. See Enabling Document Creation and Editing with Google Drive for more information.
After enabling Google Picker API for your Project, generate an API Key for the Picker API, and set up OAuth 2. Setting up OAuth 2 includes configuring an OAuth consent screen, generating OAuth 2 credentials, and adding the Liferay request URI to the list of Authorized JavaScript Origins. When generating OAuth 2 credentials, ensure you’ve selected Web application for the application type.
Once your Google Project is prepared, you must configure the Documents and Media application via the Liferay control panel. This requires the Picker API key, as well as the OAuth2 client ID and client secret.
Configuring Documents and Media
Follow these steps to configure the Documents and Media application.
-
Open the Global Menu (), click on the Control Panel tab, and go to System Settings → Documents and Media.
-
Click on Google Drive under Virtual Instance Scope.
-
Enter your project’s OAuth 2.0 client ID and client secret.
-
Enter the Picker API Key.
-
Click on Save.
Once enabled, users can create Documents and Media shortcuts to Google assets.
To disable this feature, click on the Actions button for Google Drive and select Reset Default Values.
Creating Google Drive Shortcuts
Follow these steps to create Documents and Media shortcuts for Google Drive files.
-
Open the Documents and Media application in a Site Asset Library.
-
Click on the Add button () in the Documents and Media tab and select Google Drive Shortcut.
-
Click on Select File.
-
Select the desired Google account.
-
Select the desired Google Drive file.
-
Enter a name and description for the shortcut.
-
Click on Publish when finished.
Once published, the Google Drive file can now be accessed and used in Liferay via the Documents and Media application. See Linking to Files on Google Drive for more information.