Created
February 18, 2015 17:26
-
-
Save monkbroc/9b76bec99f05cd6567e5 to your computer and use it in GitHub Desktop.
OmniAuth callback controller
This file contains 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
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController | |
skip_before_action :verify_authenticity_token | |
def sign_in_with(provider_name) | |
@user = User.from_omniauth(request.env["omniauth.auth"]) | |
sign_in_and_redirect @user, :event => :authentication | |
set_flash_message(:notice, :success, :kind => provider_name) if is_navigational_format? | |
end | |
def facebook | |
sign_in_with "Facebook" | |
end | |
def linkedin | |
sign_in_with "LinkedIn" | |
end | |
def twitter | |
sign_in_with "Twitter" | |
end | |
def google_oauth2 | |
sign_in_with "Google" | |
end | |
def developer | |
sign_in_with "Developer" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment