This project shows you how to implement a simple piece of Glassware that demos the major functionality of the Google Mirror API.
To see a fully-working demo of the quick start project, go to https://glass-python-starter-demo.appspot.com. Otherwise, read on to see how to deploy your own version.
Prerequisites
Ensure your system meets the following prerequisites for the quick start project:
- Java 1.6
- Apache Maven - used for part of the build process.
Creating a Google APIs Console project
Next, enable access to the Google Mirror API:
- Go to the Google APIs console and create a new API project.
- Click Services and enable the Google Mirror API for your new project.
- Click API Access and create an OAuth 2.0 client ID for a web application.
- Specify the product name and icon for your Glassware. These fields appear on the OAuth grant screen presented to your users.
- Select Web application and specify any value for the hostname, such as
localhost
- Click Edit settings... for the client ID to specify redirect URIs. Specify the callback URLs
for your local development web server, for example
http://localhost:8080/oauth2callback
, and for your deployed web server, for examplehttps://example.com/oauth2callback
. - Make note of the client ID and secret from the Google APIs Console. You'll need it to configure the quick start project.
Configuring the Quick Start project
Configure the Quick Start project to use your API client information by entering your client ID and
secret into src/main/resources/oauth.properties
:
# Replace these with values for your project from the Google API Console:
# https://developers.google.com/console
client_id=3141592653589793238462643383279
client_secret=ITS_A_SECRET_TO_EVERYBODY
Importing the project
The following instructions show you to import the Quick Start project source into IntelliJ and Eclipse.
IntelliJ
- Click File > Import Project....
- Point to the extracted directory.
- Select Import from existing model > Maven
Eclipse
- Install the
m2e
plugin to enable import from a maven pom file. - Click File > Import... > Maven > Existing Maven Project.
- Point to the extracted directory and import the project.
Running a local development server
You can run the Quick Start project on a local development server for testing:
$ mvn jetty:run
Deploying the Quick Start project
You can build a war file for this project using Maven:
$ mvn war:war