View Me on GitHub

HappySeed Google Oauth Install

What does this do?

The happy_seed:googleoauth depends upon happy_seed:omniauth and

  • Installs googleauth authentication
  • Creates a sub client in lib/googleapiclient that uses googles default stuff

Why do you want this?

If you want to have the user connect via google, this is the one line command for it.

Environment Variables

GOOGLE_OAUTH2_APP_ID=
GOOGLE_OAUTH2_APP_SECRET=

What needs to be done?

In config/initializers/devise.rb make sure that the scope you are requesting is correct.

Since you need to set the callbacks as urls, you'll need to create one app for local development and another app for production. (Possibly one for staging as well.)

Once you have the client connected, then you need to discover the API.

client = user.google_oauth2_client
admin_api = client.discovered_api("admin", "directory_v1")

request = { api_method: admin_api.users.list }
request[:parameters] = { domain: "happyfuncorp.com" }
response = client.execute request