/google-photos

Samples for the Google Photos Library API 📸

Primary LanguageJavaScript

Photo Frame Application

This is a Node.js application for the Google Photos Library API.

It connects an app with Google Photos through OAuth 2.0 and display a user's photos in an "online photo frame".

This app is built using Express.js and Material Design Lite.

App Overview

This web app is an online photo frame that allows users to load photos and then show these images in a full screen slideshow.

Set up

Before you can run this sample, you must set up a Google Developers project and configure authentication credentials. Follow the get started guide to complete these steps:

  1. Set up a Google Developers Project and enable the Google Photos Library API.
  2. In your project, set up new OAuth credentials for a web server application. Set the authorized JavaScript origin to http://127.0.0.1 and the authorized redirect URL to http://127.0.0.1:8080/auth/google/callback if you are running the app locally.
  3. The console will display your authentication credentials. Add the Client ID and Client secret to the file config.js, replacing the placeholder values:
// The OAuth client ID from the Google Developers console.
config.oAuthClientID = 'ADD YOUR CLIENT ID';

// The OAuth client secret from the Google Developers console.
config.oAuthclientSecret = 'ADD YOUR CLIENT SECRET';

You are now ready to run the sample:

  1. Ensure Node.JS and npm are installed and available on your system. You need Node.js v7.8.0 or later to run this sample.
  2. Navigate to the directory of this sample: REST/PhotoFrame.
  3. Install dependencies: Run npm install,
  4. Start the app: Run node app.js.

By default, the app will listen on port 8080. Open a web browser and navigate to http://127.0.0.1:8080 to access the app.

Troubleshooting

Make sure that you have configured the Client ID and the Client secret in the configuration file config.js. Also check that the URLs configured for these credentials match how you access the server. By default this is configured for 127.0.0.1 (localhost) on port 8080.

You can also start the app with additional debug logging by setting the DEBUG environment variable to true. For example:

DEBUG=TRUE node app.js