Allows 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 on your web pages.
Web server with PHP version > 5.2
Cannot be run on localhost
(workaround, use http://lvh.me
instead)
- Create a folder named
nanogp
on your web server. - Copy the content of the
dist
folder in this folder.
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';
cfg_client_id
and cfg_client_secret
can be obtained from the Google developers console.
Create and configure a new projet.
-
Open page: https://console.developers.google.com
-
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)
- Create a consent screen
Select your email address
Define the "product nameshown to user": "nanogallery2gp-YOUR-INSTANCE-NAME"
Others fields are optional
- Create
credentials
kindOAuth Client ID
Application type: "Web application"
Name: "nanogallery2gp-YOUR-INSTANCE-NAME"
Define the authorized redirect URLs: enter the full path to your authorize.php
And you get your personal and confidential Client ID
and client secret
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.
- delete the folder corresponding to the user in
admin/users
- delete application's authorization: https://myaccount.google.com/permissions
More about OAuth2: https://developers.google.com/identity/protocols/OAuth2WebServer