Last active
November 18, 2020 06:26
-
-
Save zeeshangulzar/64c682c2065043f8700aa3e21d3aa1dc to your computer and use it in GitHub Desktop.
api_authentication_controller.rb
This file contains hidden or 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
require 'authentication/token_authentication' | |
class ApiAuthenticationController < ApplicationController | |
before_filter :authenticate_request | |
private | |
def authenticate_request | |
if request && request.headers && request.headers['Authorization'] | |
token = request.headers['Authorization'] | |
@auth_client = TokenAuthentication.authenticate_token(token) | |
return if @auth_client.present? | |
end | |
head :unauthorized | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment