我正在尝试为Smartrecruiters API OAuth 2.0创建自定义Omniauth
omniauth.rb
b1 = Button(root, text="Test_Button", command=getshift)
并在模块外部(在同一文件中):
module OmniAuth
module Strategies
class SmartRecruiters < OmniAuth::Strategies::OAuth2
option :name, 'smart_recruiters'
option :client_options, {
site: 'https://www.smartrecruiters.com',
authorize_url: '/identity/oauth/allow',
}
def request_phase
super
end
def authorize_params
super.tap do |params|
%w[scope client_options].each do |v|
if request.params[v]
params[v.to_sym] = request.params[v]
end
end
end
end
end
end
routes.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :smart_recruiters, {client_id}, {client_secret},
scope: {scope},
:setup => lambda {|env|
site = "https://www.smartrecruiters.com/identity/oauth/allow"
env['omniauth.strategy'].options[:client_options].site = site
}
end
我收到此回复:
match 'auth/:provider/callback', to: 'integrations#create', via: [:get,:post]
我阅读了有关使用以下命令禁用CSRF的信息: skip_before_action:verify_authenticity_token,仅::create 在我的控制器中,但没有任何改变。
我正在使用Rails 4.2.8和Ruby 2.4.5p335。
有什么建议吗?
谢谢