You can access files stored in Google applications, such as Google Drive™ and Google Photos™, through the Document Library. This integration isn’t available by default, but you can get it by installing the Liferay Plugin for Google Drive™ from the Liferay Marketplace.
You must configure Liferay DXP to access Google’s Picker API, which accesses files stored on Google’s servers. Invoking the Google Picker API requires unique API keys and a client ID. The API keys are for accessing public data and the client ID is for authenticating and authorizing user access to non-public data. To get the keys and client ID, you must use a Google developer project. This takes three steps:
- Step 1: Enable the Google Picker API
- Step 2: Create Credentials
- Step 3: Configure Liferay DXP’s Google Apps Settings
Start by enabling the Google Picker API in a Google developer project.
Liferay DXP uses the Google Picker API to access files in Google.
Create a Google account or use an existing one.
Open the Google Developer Console.
Create a new project or use an existing one.
Search for the Google Picker API and enable it. Liferay DXP uses this API to access Google documents.
Next, you must create credentials to use with the Google API.
In the Google Developer Console, navigate to the Credentials screen for APIs & services.
Create a new OAuth client ID for a Web application. Specify the following attributes:
Google Docs Hook
http://localhost:8080by default for local development machines)
Authorized redirect URIs:
Create a new API key. Restrict the key to HTTP referrers (web sites), and set it to accept requests from your Liferay DXP instance’s URL.
Your new OAuth client ID and public API access key now appear on the Credentials screen. Keep this screen open to reference these values as you specify them in Liferay DXP. All that’s left is to enter the API key and client ID into Liferay DXP’s Google Apps configuration.
To call Google’s APIs, you must configure Liferay DXP with your Google project’s OAuth client ID and public API access key:
Navigate to Control Panel → Configuration → Instance Settings.
Click the Miscellaneous tab and expand the Google Apps section.
For Google Apps API Key, enter the Google API key that you created in the previous step.
For Google Client ID, enter the Google OAuth client ID that you created in the previous step.
Save your changes.
Your Liferay DXP instance is now ready to access Google documents from the Document Library.
In your Document Library, you can create file entries that link to Google documents, such as files stored in Google Drive™ or photos saved to Google. To link to a Google document in Documents and Media, click the Add icon () and select Google Docs. The New Google Docs screen appears.
This screen is similar to the edit screen for basic documents, except for file selection. Clicking the Select File button brings up Google’s file picker to select files from your Google Drive™ or your photos. Select the Google file you want to link to and click Publish.
A new file entry appears for the Google document you linked to. You can view the file entry as you would any file entry. The Google document’s contents show in the file entry’s preview pane. As with any file entry, the Options button () gives you access to the Download, Edit, Move, Permissions, Move to Recycle Bin, and Checkin/Checkout/Cancel Checkout options.
Great! Now you know how to access Google Docs™ from your document libraries. Next, you’ll learn how to display your Document Library’s files on your site.