Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

gatsby-source-google-photos


gatsby-source-google-photos


Npm version Npm downloads MIT license PRs welcome


gatsby-source-google-photos is a Gatsby plugin to use Google Photos as a data source.

Why use Google Photos to store your photos:

  • 💸 Free
  • 🔒 Secured
  • 🛢 Unlimited space
  • 🖥 Desktop web app
  • 📱 Mobile app
  • 🖍 In-app photos edition
  • 💾 Automatic backup from your phone
  • 🌈 gatsby-plugin-image compatible

Usage

  1. Download gatsby-source-google-photos from the NPM registry:
yarn add gatsby-source-google-photos gatsby-transformer-sharp gatsby-plugin-sharp
  1. Generate a token

The package needs 3 .env variables with the following format to work:

GOOGLE_OAUTH_CLIENT_ID=2...m.apps.googleusercontent.com
GOOGLE_OAUTH_CLIENT_SECRET=Q...axL
YOUTUBE_TOKEN={"access_token":"ya...J0","refresh_token":"1..mE","scope":"https://www.googleapis.com/auth/photoslibrary.readonly","token_type":"Bearer","expiry_date":1598284554759}

gatsby-source-google-photos expose a script to make the generation easier. Open a terminal at the root of your project and type:

npx gatsby-source-google-photos-token
  1. Add the plugin in your gatsby-config.js file
module.exports = {
    plugins: [
        {
            resolve: "gatsby-source-google-photos",
            options: {
                albumsTitles: ["TITLE_A", "TITLE_B"],
            },
        },
        // Recommanded to use with gatsby-plugin-image
        "gatsby-transformer-sharp",
        "gatsby-plugin-sharp",
        "gatsby-plugin-image",
    ],
}
  1. Query your photos

Showcase

You are using gatsby-source-google-photos for your website? Thank you!

Please add your website to the Showcase

Documentation

Contributing

  • ⇄ Pull/Merge requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.

Changelog

See CHANGELOG

License

This project is licensed under the MIT License - see the LICENCE file for details

© 2023 Gatsby, Inc.