Created
November 18, 2015 16:26
-
-
Save JackBracken/16f5f5c043762ca56240 to your computer and use it in GitHub Desktop.
Get auth token from header or params example
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
def authenticate_user_from_token! | |
user_token = request.headers['Auth-Token'].presence || params[:auth_token].presence || nil | |
user = user_token && User.find_by_authentication_token(user_token.to_s) | |
if user | |
@current_user = user | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment