我使用" omniauth-greenhouse宝石将oauth用于温室。但是,在身份验证之后,我看到回调已启动两次,并显示以下消息
(greenhouse) Setup endpoint detected, running now.
(greenhouse) Request phase initiated.
Started GET "/auth/greenhouse" for 127.0.0.1 at 2014-08-27 21:41:49 -0700
(greenhouse) Setup endpoint detected, running now.
(greenhouse) Callback phase initiated.
/Users/ViswaMani/futura-project-enterprise/script/rails: No such file or directory -
(greenhouse) Callback phase initiated.
(greenhouse) Authentication failure! invalid_credentials: OAuth2::Error, <!DOCTYPE html>
由于第二次调用,invalid_credentials即将到来。
我制作了一个新的示例应用程序,它使用了gem和相同的凭据,我能够端到端地进行授权。我不确定我的主应用程序中存在什么问题。
没有device.rb,我只在omniauth.rb中创建一次oauth,如下所示:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :greenhouse, 'foo', 'bar',
:scope => 'candidates.create candidates.view jobs.view',
:provider_ignores_state => true,
:setup => lambda { |env| env['omniauth.strategy'].options[:client_options][:site] = 'https://app.greenhouse.io' }
end