View Source Assent.Strategy.Google (Assent v0.2.9)

Google OAuth 2.0 strategy.

In the normalized user response a google_hd ("Hosted Domain") field is included in user parameters and can be used to limit access to users belonging to a particular hosted domain.

Usage

config = [
  client_id: "REPLACE_WITH_CLIENT_ID",
  client_secret: "REPLACE_WITH_CLIENT_SECRET",
  redirect_uri: "http://localhost:4000/auth/callback"
]

To get the refresh token, it's necessary to pass access_type: "offline" in the authorization request:

config = [
  client_id: "REPLACE_WITH_CLIENT_ID",
  client_secret: "REPLACE_WITH_CLIENT_SECRET",
  authorization_params: [
    access_type: "offline",
    scope: "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
  ]
]

See Assent.Strategy.OAuth2 for more.