From 69d4ef0fb2bce1734b6a05293f0290e8e756829d Mon Sep 17 00:00:00 2001 From: Bilal Date: Mon, 3 Aug 2020 15:28:22 +0200 Subject: [PATCH] monkeypatch knock --- app/controllers/api/user_token_controller.rb | 4 ++++ lib/knock_monkeypatch.rb | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 lib/knock_monkeypatch.rb diff --git a/app/controllers/api/user_token_controller.rb b/app/controllers/api/user_token_controller.rb index 401127f..cae81f9 100644 --- a/app/controllers/api/user_token_controller.rb +++ b/app/controllers/api/user_token_controller.rb @@ -1,3 +1,7 @@ +# frozen_string_literal: true + +require './lib/knock_monkeypatch' + class Api::UserTokenController < Knock::AuthTokenController include Oath::ControllerHelpers diff --git a/lib/knock_monkeypatch.rb b/lib/knock_monkeypatch.rb new file mode 100644 index 0000000..ade5f2c --- /dev/null +++ b/lib/knock_monkeypatch.rb @@ -0,0 +1,7 @@ +module Knock + class AuthTokenController < ApplicationController + skip_before_action :authenticate + alias authenticate_with_token authenticate + before_action :authenticate_with_token + end +end \ No newline at end of file