Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kul1/google-api-web
Test Google API Web
https://github.com/kul1/google-api-web
Last synced: 26 days ago
JSON representation
Test Google API Web
- Host: GitHub
- URL: https://github.com/kul1/google-api-web
- Owner: kul1
- Created: 2018-04-15T17:28:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-04-17T04:12:54.000Z (over 6 years ago)
- Last Synced: 2024-10-10T05:03:40.898Z (about 1 month ago)
- Language: Ruby
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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 originAdditional 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
```# Start Redis First!!!
> To have launchd start redis now and restart at login:
> brew services start redis
> Or, if you don't want/need a background service you can just run:
> redis-server /usr/local/etc/redis.conf# Running the samples
To start the server, run
```
ruby app.rb
```Open `http://localhost:4567/` in your browser to explore the sample.