Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile
a14m / facebook.rb
Last active Oct 19, 2020
Gist for manually OAuth2 facebook for Rails APIs
View facebook.rb
# lib/omniauth/facebook.rb
require 'httparty'
module Omniauth
class Facebook
include HTTParty
# The base uri for facebook graph API
base_uri ''
a14m / api_controller.rb
Created Jan 16, 2015
Rails JWT authentication
View api_controller.rb
# app/controllers/api/v1/api_controller.rb
# Base API controller class
class Api::V1::ApiController < ApplicationController
before_action :http_authorization_header?, :authenticate_request, :set_current_user
# Bad Request if http authorization header missing
def http_authorization_header?
fail BadRequestError, 'errors.missing_auth_header' unless authorization_header