zquestz/omniauth-google-oauth2 — pull request #22 by icambron (2012-04-18 02:19:36+00:00)
Title: added state parameter

I need to be able to pass the `state` parameter to Google's approval endpoint. Google then passes that parameter back to the callback; it's a clean way keep state across the request without stashing stuff in the session.

Ideally, it would be part of the parameters passed to the `/auth/google_oauth2` URL and then merged with the authorization parameters (that's how the FB OmniAuth plugin works), but that didn't seem to be in keeping with the library, which never reads anything off the request. So I just added it as authorization parameter and left it at that. To use it, I do the same thing I do with `approval_prompt` to override the setting on a per-request basis: I intercept the request in the builder middleware and set the parameter on the env. That definitely seems kludgy since you probably always want to determine the `state` parameter on-the-fly, but then again, I think think the same thing about the `approval prompt`.

Let me know if that makes sense. If you want, I'd be happy to submit a separate pull request making all the parameters (approval_prompt, access_type, scope, etc), merge with what comes in on the request.