See these links:
- Strategy to authenticate with Google via OAuth2 in OmniAuth.
- A gem containing a generic OAuth2 strategy for OmniAuth
Get your API key at:
https://code.google.com/apis/console
Note the Client ID and the Client Secret.
For more details, read the Google docs: