有没有人将omniauth与rails 2.3.8一起使用? [英] Has anyone used omniauth with rails 2.3.8?

查看:58
本文介绍了有没有人将omniauth与rails 2.3.8一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Rails的新手,我正在尝试将omniauth与Rails 2.3.8一起使用.一世 找不到此版本的rails的任何教程,所以我提到了 http://blog.railsrumble.com/blog/2010/10/08 /intridea-omniauth .

I am new to Rails and I am trying to use omniauth with rails 2.3.8. I couldn't find any tutorial for this version of rails so I referred to http://blog.railsrumble.com/blog/2010/10/08/intridea-omniauth.

我添加了初始化器,如下所示:

I added the initializer as follows:

OmniAuth::Strategies::Twitter = { 
    :consumer_key => 'xxxxxx', 
    :consumer_secret => 'xxxxxx' 
} 

在此步骤之后,如果我尝试点击URL'/auth/twitter',则会收到否 路由将{/auth/twitter与{:method =>:get}"匹配.

After this step if I try to hit the URL '/auth/twitter' then I get "No route matches "/auth/twitter" with {:method=>:get}".

有人用过带有rails 2.3.8的omniauth吗?

Has anyone used omniauth with rails 2.3.8?

推荐答案

OmniOauth是Rack :: Middleware.因此,您需要像这样使用它.

OmniOauth is a Rack::Middleware. So you need use it like that.

所以您需要这样添加:

ActionController::Dispatcher.middleware.use OmniAuth::Strategies::Twitter = { 
    :consumer_key => 'xxxxxx', 
    :consumer_secret => 'xxxxxx' 
} 

这篇关于有没有人将omniauth与rails 2.3.8一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆