README.md (2144B)
1 # Introduction 2 This is a sample application to view your files in Google Drive. It uses OAuth 3 2.0 to talk to the Google API. 4 5 # Installation 6 This example application uses [Composer](http://www.getcomposer.org) for its 7 dependency management. You can install the dependencies like this: 8 9 $ php composer.phar install 10 11 # Configuration 12 You need to get yourself a `client_secrets.json` file from the 13 [Google API Console](https://code.google.com/apis/console/). You can download 14 one once you register the application. 15 16 **WARNING** 17 This sample application expects `client_secrets.json` in the root of the 18 project directory, so it will also be accessible through the web browser by 19 just requesting this file! In real deployments you will want to move this file 20 somewhere else. 21 22 My `client_secrets.json` looks like this (after formatting): 23 24 { 25 "web": { 26 "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", 27 "auth_uri": "https://accounts.google.com/o/oauth2/auth", 28 "client_email": "624925808472@developer.gserviceaccount.com", 29 "client_id": "624925808472.apps.googleusercontent.com", 30 "client_secret": "HERE_USED_TO_BE_MY_SECRET", 31 "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/624925808472@developer.gserviceaccount.com", 32 "javascript_origins": [ 33 "https://fkooman.pagekite.me" 34 ], 35 "redirect_uris": [ 36 "https://fkooman.pagekite.me/php-drive-client/callback.php" 37 ], 38 "token_uri": "https://accounts.google.com/o/oauth2/token" 39 } 40 } 41 42 This contains all the information the sample clients needs to find the OAuth 43 2.0 server and request an access token. When you register a client it is 44 important to set the `redirect_uris` correctly. This has to point to the 45 `callback.php` script on your server. 46 47 The `callback.php` script will redirect back to `index.php` after the access 48 token was obtained. You need to modify the URL in the `callback.php` script to 49 point to the location where your `index.php` is located.