I'm using Devise Invitable on my app, and Omniauth to allow users to sign in with Facebook.
The only thing I'm having trouble with is when a user chooses to sign in with Facebook using the link within the Invitation Accept page, they're redirected to the New User Registration page with some details already filled in. The problem is since Devise Invitable creates a new users when it sends an invitation, users are unable to login using the email that was supplied when the invitation was sent.
Omniauth Callbacks Controller
def all
user = User.from_omniauth(request.env["omniauth.auth"])
if user.persisted?
flash.notice = "Signed in!"
sign_in_and_redirect user
else
session["devise.user_attributes"] = user.attributes
redirect_to new_user_registration_url
end
end
alias_method :facebook, :all