Bir ray hareket kontrolöründen Doorkeeper yönteminin doğrulanması için bir şans var mı? Sadece eylemlerimden biri için kimlik doğrulamasını atlamak istiyorum ('show') ancak belirli bir koşul varsa apiauthenticate yöntemini işini yapmak için çağırmak istiyorum. Yani eylemde 'gösteri', her şeyden önce bir koşulu kontrol ederim ve eğer geçerli değilse, o zaman api_authenticate'ı aktive etmem gerekiyor. Api_authenticate'ı çağırması ve orada durdurması gereken bir test başlatıyorum. Ama bir sebepten dolayı devam ediyor ve durmuyor. Erişim Kapıcı hareket et Rails Kontrol Cihazı
Bu
benim denetleyicisiskip_before_action :api_authenticate, only: :show
def show
param! :id, String, required: true
post = Services::Posts.find(params[:id])
if post.public
@post = post
@user_id = nil
else
api_authenticate
ap "it shouldnt get here if user is not logged in"
user = current_resource_owner
@post = Services::Posts.show(params[:id], user)
@user_id = user.identity rescue nil
end
end
#more actions....
ait kodudur Ve bu kimlik doğrulaması yöntemini benzer
class ApiController < ApplicationController
protect_from_forgery with: :null_session
# Check the user is authenticated
before_action :api_authenticate
rescue_from ActionController::RoutingError, :with => :route_error
rescue_from ::AbstractController::ActionNotFound, :with => :action_error
rescue_from Exception, :with => :base_error if Rails.env.production?
def api_authenticate
doorkeeper_authorize!()
end
end