遵循教程后出现意外结果 (omniauth twitter) 没有路由匹配 [GET] “/auth/twitter”

发布于 2024-12-25 11:22:52 字数 288 浏览 2 评论 0原文

我一步步遵循本指南: http://railscasts.com/episodes/241-simple-omniauth

当我点击进入 Twitter 的按钮时,结果是这样的:

没有路由匹配 [GET]“/auth/twitter”

我做了几次尝试,以慢动作观看视频......但结果总是相同

I followed this guide step by step: http://railscasts.com/episodes/241-simple-omniauth

When I click the button that would take me on twitter, the result is this:

No route matches [GET] "/auth/twitter"

I made ​​several attempts, watching the video in slow motion ... but the result is always the same

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

讽刺将军 2025-01-01 11:22:52

以后,尝试分享您的相关代码以进行调试。但是,请确保您具备以下条件。

在您的路线中,确保您

devise_for :users, :controllers => {:omniauth_callbacks => "users/omniauth_callbacks" ...

的设计初始值设定项中有类似 and 的内容

config.omniauth :facebook, facebook_app_id, facebook_app_secret,
     { :scope => 'yourscopeshere', :client_options => {:ssl => {:ca_path => "/etc/ssl/certs"}} }

In the future, try to share your relevant code for debugging purposes. However, make sure you have the following.

In your routes, make sure you have something like

devise_for :users, :controllers => {:omniauth_callbacks => "users/omniauth_callbacks" ...

and in your, devise initializer

config.omniauth :facebook, facebook_app_id, facebook_app_secret,
     { :scope => 'yourscopeshere', :client_options => {:ssl => {:ca_path => "/etc/ssl/certs"}} }
漆黑的白昼 2025-01-01 11:22:52

您需要在 Devise gem 使用的模型中注释掉 ':omniauthable' (通常是模型 'User' = user.rb 文件):

class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable, :recoverable,
         :rememberable, :trackable, :validatable # plus whatever other calls...
       # :omniauthable

  [...]

end

使用 ':omniauthable' 调用意味着加载 devise/omniauth 组件(这会导致冲突使用您的omniauth 设置)。

You need to comment out ':omniauthable' in your model used by the Devise gem (usually it's the model 'User' = the user.rb file):

class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable, :recoverable,
         :rememberable, :trackable, :validatable # plus whatever other calls...
       # :omniauthable

  [...]

end

Using the ':omniauthable' call means loading devise/omniauth components (which cause conflicts with your omniauth setup).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文