Created
March 31, 2011 09:19
-
-
Save aliang/896096 to your computer and use it in GitHub Desktop.
returning after omniauth
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
# Link to /sign-in/:provider?return_to=current_page in your view. This example shows auth using Twitter in a HAML view | |
%a{ :href => "/sign-in/twitter?return_to=" + request.env['PATH_INFO'] } |
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
# Add this to your routes.rb file | |
match "/sign-in/:provider" => "sessions#sign_in" |
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
# Add this to your sessions controller. | |
def sign_in | |
session[:return_to] = params[:return_to] | |
redirect_to "/auth/" + params[:provider] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment