Skip to content

Instantly share code, notes, and snippets.

@cmattson
Last active December 18, 2015 21:29
Show Gist options
  • Save cmattson/5847954 to your computer and use it in GitHub Desktop.
Save cmattson/5847954 to your computer and use it in GitHub Desktop.
Need to get params back from some OAuth provider that doesn't let you explicitly pass them back? Though it's not (well?) documented, OmniAuth will store any existing params in request.env["omniauth.params"].
# In your CallbacksController, pass omniauth.params:
@user = User.find_for_PROVIDER_oauth(
request.env["omniauth.auth"],
request.env["omniauth.params"],
current_user
)
# In your model, add a second parameter to the method definition:
def self.find_for_PROVIDER_oauth(auth, params=nil, signed_in_resource=nil)
# And while you're poking around in your Devise model, you may want your oauth methods
# to set confirmed_at at creation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment