|
1 | | -# Google Auth PHP Sample Application |
| 1 | +# Google Auth on App Engine Standard for PHP 7.2 |
2 | 2 |
|
3 | | -[![Open in Cloud Shell][shell_img]][shell_link] |
4 | | - |
5 | | -[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png |
6 | | -[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googlecloudplatform/php-docs-samples&page=editor&working_dir=auth |
| 3 | +This sample application demonstrates how to [Authenticate Users](https://cloud.google.com/appengine/docs/standard/php7/authenticating-users) |
| 4 | +on App Engine Standard. |
7 | 5 |
|
8 | 6 | ## Description |
9 | 7 |
|
10 | | -This command-line application shows how to authenticate to Google Cloud APIs |
11 | | -using different methods. This sample uses Storage as an example, but these |
12 | | -methods will work on any Google Cloud API. |
| 8 | +This application shows how to authenticate to Google Cloud APIs using two |
| 9 | +different methods. This sample uses Storage as an example, but these methods |
| 10 | +will work for any Google Cloud API. |
| 11 | + |
| 12 | +## Deploy to App Engine |
13 | 13 |
|
14 | | -## Build and Run |
15 | 14 | 1. **Enable APIs** - [Enable the Storage API](https://console.cloud.google.com/flows/enableapi?apiid=storage-api.googleapis.com) |
16 | 15 | and create a new project or select an existing project. |
17 | | -2. **Download The Credentials** - Click "Go to credentials" after enabling the APIs. Click "New Credentials" |
18 | | - and select "Service Account Key". Create a new service account, use the JSON key type, and |
19 | | - select "Create". Once downloaded, set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` |
20 | | - to the path of the JSON key that was downloaded. |
21 | | -3. **Clone the repo** and cd into this directory |
22 | | -``` |
| 16 | +1. **Clone the repo** and cd into this directory |
| 17 | + ``` |
23 | 18 | $ git clone https://github.com/GoogleCloudPlatform/php-docs-samples |
24 | | - $ cd php-docs-samples/auth |
25 | | -``` |
26 | | -4. **Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md). |
27 | | - Run `php composer.phar install --no-dev` (if composer is installed locally) or `composer install --no-dev` |
28 | | - (if composer is installed globally). |
29 | | -5. Run `gcloud app deploy` to deploy to App Engine. |
30 | | - |
31 | | -## Contributing changes |
32 | | - |
33 | | -* See [CONTRIBUTING.md](../CONTRIBUTING.md) |
34 | | - |
35 | | -## Licensing |
36 | | - |
37 | | -* See [LICENSE](../LICENSE) |
| 19 | + $ cd php-docs-samples/appengine/php72/auth |
| 20 | + ``` |
| 21 | +1. **Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md). |
| 22 | + Run `php composer.phar install --no-dev` (if composer is installed locally) |
| 23 | + or `composer install --no-dev` (if composer is installed globally). |
| 24 | +1. Run `gcloud app deploy` to deploy to App Engine. |
| 25 | +
|
| 26 | +## Run Locally |
| 27 | +
|
| 28 | +1. **Download The Credentials** - Click "Go to credentials" after enabling the |
| 29 | + APIs. Click "New Credentials" and select "Service Account Key". Create a new |
| 30 | + service account, use the JSON key type, and select "Create". Once |
| 31 | + downloaded, set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to |
| 32 | + the path of the JSON key that was downloaded. |
| 33 | +1. Run PHP's built-in web server with the command `php -S localhost:8000` and |
| 34 | + then view the application in your browser at |
| 35 | + [http://localhost:8000](http://localhost:8000). |
0 commit comments