【问题标题】:Twitter Omniauth error with Ruby on RailsRuby on Rails 的 Twitter Omniauth 错误
【发布时间】:2013-05-30 10:24:12
【问题描述】:

您好,我正在尝试解决此问题,我正在尝试在不使用设计 gem 的情况下集成 twitteromniauth,并且给了我以下错误。

401 Unauthorized

我在推特上唱歌的链接如下

<%= link_to "Sign in with Twitter", "/auth/twitter" %>

我的 confing/initializers/omniauth.rb 设置如下

Rails.application.config.middleware.use OmniAuth::Builder do

provider :twitter, ENV['xxxxx'], ENV['xxxxxxxxxxxx']

end

关于更多详细信息,我已经打开了 twitter 设置上的应用程序以允许登录并有一个回调 url。

提前感谢您的帮助。

【问题讨论】:

  • 什么时候出错?
  • @oldergod 当您点击链接登录 Twitter 时会发生这种情况。
  • 你的回调 url 是否设置为 localhost ?
  • 是的 @oldergod 正在 localhost:5000 中运行

标签: ruby-on-rails ruby ruby-on-rails-3 twitter omniauth


【解决方案1】:

您可以在OAuth::Unauthorized 401 int twitter-omniauth gem找到信息

如果你说你的回调 url 设置为 localhost,我认为是问题所在。

您可以使用像http://goo.gl/ 这样的短网址并将您的回调网址替换为适合您的网址。

http://localhost:5000/ => http://goo.gl/6cpbd
https://localhost:5000/ => http://goo.gl/z6C77

【讨论】:

    猜你喜欢
    • 2014-08-14
    • 2012-02-08
    • 2015-04-20
    • 1970-01-01
    • 1970-01-01
    • 2013-05-01
    • 2014-04-24
    • 1970-01-01
    • 2013-05-24
    相关资源
    最近更新 更多