Last active
December 18, 2015 21:29
-
-
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"].
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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