is there any way to skip authentication in custom_active admin actions

831 Views Asked by At

So, I have a collection_action in active admin that is used by PandaStream api to send back notifications when video is processed:

  collection_action :notify, :method => :post do
    # some irrelevant to the question code
  end

rake routes returns:

notify_admin_videos POST       /admin/videos/notify(.:format)            admin/videos#notify

The problem is when I got notification from pandastream, I get:

Completed 401 Unauthorized in 0ms

That's expected as the panda api is not authenticated in my admin panel. So question is, is there any way to skip authentication in custom_active admin actions?

Please help clear this up for me!

Thanks!

1

There are 1 best solutions below

0
On BEST ANSWER

Certain methods are delegated from the admin register to the controller, as shown here: https://github.com/gregbell/active_admin/blob/4f445b51c22b12af2cdde57fe2ce9835c32ef88e/lib/active_admin/resource_dsl.rb#L156

So you should be able to do something like below:

ActiveAdmin.register Video do
  skip_before_action :authenticate_admin_user!, only: :notify
end