Skip to content

Instantly share code, notes, and snippets.

@JackBracken
Created November 18, 2015 16:26
Show Gist options
  • Save JackBracken/16f5f5c043762ca56240 to your computer and use it in GitHub Desktop.
Save JackBracken/16f5f5c043762ca56240 to your computer and use it in GitHub Desktop.
Get auth token from header or params example
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