ueberauth / ueberauth_google

Google OAuth2 Strategy for Überauth.
MIT License
164 stars 85 forks source link

Passing custom parameters to auth flow #16

Closed venkatd closed 7 years ago

venkatd commented 8 years ago

Without access_type, I'm not able to get a refresh token for offline access, so I patched the lib for some customer parameters that I wanted.

  @doc """
  Handles initial request for Google authentication.
  """
  def handle_request!(conn) do
    scopes = conn.params["scope"] || option(conn, :default_scope)
    # added response_type, access_type, and approval_prompt
    opts = [ scope: scopes, response_type: "code", access_type: "offline", approval_prompt: "force" ]
    if conn.params["state"], do: opts = Keyword.put(opts, :state, conn.params["state"])
    opts = Keyword.put(opts, :redirect_uri, callback_url(conn))

    redirect!(conn, Ueberauth.Strategy.Google.OAuth.authorize_url!(opts))
  end

What is the proper way to pass custom options? If this isn't supported, what can I do to help improve the library? Thanks!

nambrot commented 8 years ago

Just stumbled across this one, and would also support having the ability to have offline access

doomspork commented 7 years ago

Address in #23