Skip to content

Commit

Permalink
Refactored to use functions rather than App Engine apps, added tests,…
Browse files Browse the repository at this point in the history
… added README
  • Loading branch information
ryanmats committed Aug 4, 2017
1 parent b24733e commit 784ca19
Show file tree
Hide file tree
Showing 19 changed files with 250 additions and 5,232 deletions.
45 changes: 45 additions & 0 deletions auth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Google Auth PHP Sample Application

## Description

This command-line application shows how to authenticate to Google Cloud APIs
using different methods. This sample uses Storage as an example, but these
methods will work on any Google Cloud API.

## Build and Run
1. **Enable APIs** - [Enable the Storage API](https://console.cloud.google.com/flows/enableapi?apiid=storage-api.googleapis.com)
and create a new project or select an existing project.
2. **Download The Credentials** - Click "Go to credentials" after enabling the APIs. Click "New Credentials"
and select "Service Account Key". Create a new service account, use the JSON key type, and
select "Create". Once downloaded, set the environment variable `GOOGLE_APPLICATION_CREDENTIALS`
to the path of the JSON key that was downloaded.
3. **Clone the repo** and cd into this directory
```
$ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
$ cd php-docs-samples/auth
```
4. **Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md).
Run `php composer.phar install` (if composer is installed locally) or `composer install`
(if composer is installed globally).
5. Run `php auth.php`. The following commands are available and work on command line:
```
auth-cloud-implicit Authenticate to a cloud client library using a service account implicitly.
auth-cloud-explicit Authenticate to a cloud client library using a service account explicitly.
```
6. The following commands are available but will throw a ServiceException when
run from command-line. The Compute Engine method only works on Compute Engine,
App Engine Flexible, Cloud Functions, and Container Engine. The App Engine
method only works on App Engine Standard.
```
auth-cloud-explicit-compute-engine Authenticate to a cloud client library using Compute Engine credentials explicitly.
auth-cloud-explicit-app-engine Authenticate to a cloud client library using App Engine Standard credentials explicitly.
```
7. Run `php auth.php COMMAND --help` to print information about the usage of each command.

## Contributing changes

* See [CONTRIBUTING.md](../../CONTRIBUTING.md)

## Licensing

* See [LICENSE](../../LICENSE)
10 changes: 0 additions & 10 deletions auth/appengine/app.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions auth/appengine/composer.json

This file was deleted.

Loading

0 comments on commit 784ca19

Please sign in to comment.