Virtuoso's Sponger cartridge for Google+ allows you to fetch a Google+ user's profile and the Activities they post. These notes, intended for a 'Sponger Administrator', provide brief configuration guidelines for the cartridge.
The cartridge is written to the Google+ API. The cartridge can be configured to use either:
Option 2 pre-dates option 1. VAL OAuth is the preferred option. Whether configured using OAuth or an API key, only public data is available from the Google+ API.
Support for OAuth is provided through the Virtuoso Authentication Layer (VAL). All cartridges using VAL as the basis for their OAuth support are configured in a similar manner. For an overview of how to configure a cartridge's VAL OAuth binding, see topic Sponger OAuth Support via VAL.
You will need to register OAuth application keys for the Google+ OAuth service in Conductor's 'Login Authentication Keys' panel, accessible through the 'Linked Data' and 'OAuth Service Binding' tabs.
Default installations of a Virtuoso Sponger instance include a Sponger front page, located at http://{virtuoso-host}/sponger, which includes a number of buttons for generating sample Sponger links for particular, typically social site, cartridges.
You can sponge your Google+ profile, and transform it to Linked Data, by clicking on the Google+ button.
If the cartridge has been configured to use OAuth, you will be asked to authenticate via your Google+ login, after which the Sponger can determine your Google+ ID. If the cartridge has been configured to use an API key, you will be prompted to enter your Google+ ID (unless a global OAuth token has been set in the cartridge options solely to enable automatic Google+ ID retrieval for /sponger - see the section Configuring Google+ User ID Detection when Using an API Key for details). Once your Google+ ID is known, the Sponger creates sample Sponger links through which you can sponge your Google+ profile.
The cartridge is configured to trigger on the URI pattern https://plus.google.com/.* , i.e. the expected starting point for sponging a Google+ user's profile is a URL of the form https://plus.google.com/{user-id}. The generated sample links proxy this base URL. For example:
We can take a look at the /fct variant of the primaryTopic object page:
Because some Google+ user profiles can include hundreds of Activities and associated Comments, the following cartridge options are available to set configurable limits on the number of items returned.
items_per_activity_page:
When the Google+ cartridge is configured to use an API key, setting a client ID and secret (for Google+ user ID detection by the /sponger endpoint) is optional.
If not set, the /sponger Google+ button requires a user to enter their Google+ ID in order to generate the sample Sponger links.
When configured, the user's Google+ ID can be determined automatically.
The user must simply log into Google (if not already) and grant the Sponger access to their profile.
Note: When the cartridge is using VAL, entering a client-id and secret in the cartridge options as described below is not required.
To obtain a client-id and secret, return to the 'Credentials' section of the Google Developers Console where you obtained an API key as detailed above.
In the 'OAuth' area, click the 'Create new Client ID' button.
Set the application type to 'Web application' and ensure the Authorized Redirect URI is of the form http://{virtuoso-host}/google_oauth.
Note the generated Client ID and Client Secret before signing out of the console.
Next, the Client ID and Client Secret must be saved as option values in the Google+ cartridge configuration.
Select the Google+ cartridge from the Extractor Cartridges tab under the Linked Data / Sponger tab in the Conductor UI.
In the Options text area, enter options client_id=xxx client_secret=yyy, substituting the Client ID and Client Secret values just noted.
Click the 'Update' button to save the new options.
Now, when a user clicks on the Google+ button on the Sponger front page, they should be prompted to log into Google and asked to grant access to the Sponger. If granted, the Sponger accesses their profile, determines their Google+ ID and generates sample Sponger links for the Google+ cartridge.
In most cases, OAuth-enabled Sponger cartridges retain access tokens for future use to allow an incremental sponge or complete re-sponge of the user's data (i.e. those portions of their data the user has granted access to). Google access tokens are always expiring tokens (even if offline access is specified when requesting a token) and must be refreshed through refresh tokens. They typically expire after 1 hour. Access tokens obtained through VAL are automatically refreshed as needed. Those obtained through a client id and client secret configured in the cartridge options are used only for the initial profile retrieval to build the sample Sponger URIs and are not saved for future use by the cartridge.