Sha256: ce72c725e675d4e0e5c9a26bcd5b699f53ef07324a008dacdf5b681f2d3556e6

Contents?: true

Size: 1.32 KB

Versions: 161

Compression:

Stored size: 1.32 KB

Contents

# API Samples

This directory contains a simple Sinatra web app illustrating how to use the client
in a server-side web environment.

It illustrates a few key concepts:

* Using [Google Sign-in](https://developers.google.com/identity) for authentication.
* Using the [googleauth gem](https://github.com/google/google-auth-library-ruby) to
  request incremental authorization as more permissions are needed.

# Setup

* Create a project at https://console.developers.google.com
* Go to the `API Manager` and enable the `Drive` and `Calendar` APIs
* Go to `Credentials` and create a new OAuth Client ID of type 'Web application'
    * Use `http://localhost:4567/oauth2callback` as the redirect URL
    * Use `http://localhost:4567` as the JavaScript origin

Additional details on how to enable APIs and create credentials can be
found in the help guide in the console.

## Example Environment Settings

For convenience, application credentials can be read from the shell environment
or placed in a .env file.

After setup, your .env file might look something like:

```
GOOGLE_CLIENT_ID=479164972499-i7j6av7bp2s4on5ltb7pjXXXXXXXXXX.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=JBotCTG5biFWGzXXXXXXXXXX
```

# Running the samples

To start the server, run

```
ruby app.rb
```

Open `http://localhost:4567/` in your browser to explore the sample.

Version data entries

161 entries across 161 versions & 2 rubygems

Version Path
google-api-client-0.35.0 samples/web/README.md
google-api-client-0.34.1 samples/web/README.md
google-api-client-0.34.0 samples/web/README.md
google-api-client-0.33.2 samples/web/README.md
google-api-client-0.33.1 samples/web/README.md
google-api-client-0.33.0 samples/web/README.md
google-api-client-0.32.1 samples/web/README.md
google-api-client-0.32.0 samples/web/README.md
google-api-client-0.31.0 samples/web/README.md
google-api-client-0.30.10 samples/web/README.md
google-api-client-0.30.9 samples/web/README.md
google-api-client-0.30.8 samples/web/README.md
google-api-client-0.30.7 samples/web/README.md
google-api-client-0.30.6 samples/web/README.md
google-api-client-0.30.5 samples/web/README.md
google-api-client-0.30.4 samples/web/README.md
google-api-client-0.30.3 samples/web/README.md
google-api-client-0.30.2 samples/web/README.md
google-api-client-0.30.1 samples/web/README.md
google-api-client-0.30.0 samples/web/README.md