Clone or download
Latest commit 77d0e9a Jul 19, 2017
Failed to load latest commit information.
dist Add files via upload Jul 18, 2017
img Add files via upload Mar 9, 2017
LICENSE Initial commit Feb 17, 2017 Add files via upload Jul 18, 2017


Add-on for nanogallery2 to access Google Photos content.

Since february 9, 2017, Google Photos can no more be accessed without account owner's explicit authorization. Permanent authorization is only possible for server side applications.

nanogp is a PHP application which delivers Google Photos content to nanogallery2.

- --> WARNING: please use NANOGP only with a Google Photos account which does not contain any personal or privat data.
- All your photos albums can be accessed by NANOGP. This may be misused by malicious people.
- configure the option `$albums_filter` to protect your privacy!


Web server with PHP version > 5.2
Cannot be run on localhost (workaround, use instead)

Installation procedure

  • Create a folder named nanogp on your web server.
  • Copy the content of the dist folder in this folder.

Upgrade procedure

Copy the content of the dist folder to your server, but never overwrite the tools.php file.
If you overwrite it, you'll need to set the configuration again.


Settings are defined in admin/config.php:

  $cfg_client_id     = 'yyy';
  $cfg_client_secret = 'zzz';
  $albums_filter     = ['sauvegarde', 'backup'];

$cfg_client_id and $cfg_client_secret can be obtained from the Google developers console.
$albums_filter is used to filter albums out. Albums with a title containing one of the string will not be displayed.

Enable Google API - Google developers console

Create and configure a new projet.

  1. Open page:

  2. Create a new project named nanogallery2gp-YOUR-INSTANCE-NAME (the project name should be unique, so replace YOUR-INSTANCE-NAME with the name of your own instance)

step 1

step 2

  1. Create a consent screen

Select your email address

Define the "product nameshown to user": "nanogallery2gp-YOUR-INSTANCE-NAME"

Others fields are optional

step 3

  1. Create credentials kind OAuth Client ID

step 4

Application type: "Web application"
Name: "nanogallery2gp-YOUR-INSTANCE-NAME"

Define the authorized redirect URLs: enter the full path to your authorize.php

step 5

And you get your personal and confidential Client ID and client secret

step 6

Grant authorization

Once the settings are defined, you need to grant authorization to your Google Photos account.
Use a browser to open the authorize.php page: http://your_webserver/nanogp/authorize.php

(if you want to grant authorization again, follow steps from the section Manually revoke authorization).


The admin folder should only be accessible to your PHP applications.
For example, with deny from all set in .htaccess file.

Manually revoke authorization


More about OAuth2: