我正在编写一个 rails 3 应用程序,我试图让人们使用 LinkedIn 登录或注册。我已经按照https://github.com/datawrangling/linkedin_on_rails上的教程进行操作,但得到了一些奇怪的结果。出于某种原因,应用程序在 POST /user_sessions 之后调用 /user_sessions 上的 GET,这会将我的凭据发送到 LinkedIn。这是来自 rails 服务器的日志:
Started POST "/user_sessions" for 127.0.0.1 at 2011-03-16 21:56:13 -0700
Processing by UserSessionsController#create as HTML
Parameters: {"utf8"=>"✓","authenticity_token"=>"M+W0ExS4FZE5wg/hPI6FzL4dnAGdTS/yllQWqOoSNRs=",
"user_session"=>{"username"=>"", "password"=>"[FILTERED]", "remember_me"=>"0"},
"login_with_oauth"=>"Login with LinkedIn"}
Redirected to https://www.linkedin.com/uas/oauth/authenticate?oauth_token=76e56c85-3896-419a-ab94-15a05332d04b
Completed 302 Found in 455ms
Started GET "/user_sessions?oauth_token=76e56c85-3896-419a-ab94-15a05332d04b&oauth_verifier=86765" for 127.0.0.1 at 2011-03-16 21:56:13 -0700
Processing by UserSessionsController#index as HTML
Parameters: {"oauth_token"=>"76e56c85-3896-419a-ab94-15a05332d04b", "oauth_verifier"=>"86765"}
Rendered layouts/_stylesheets.html.erb (1.9ms)
Rendered layouts/_header.html.erb (78.3ms)
Rendered layouts/_footer.html.erb (3.3ms)
Rendered user_sessions/index.html.erb within layouts/application (94.6ms)
Completed 200 OK in 103ms (Views: 101.3ms | ActiveRecord: 0.0ms)
我已经为 user_sessions 控制器删除了 :index ,这样我就不会因错误而失败:
No route matches "/user_sessions"
但我不明白为什么我没有被重定向到登录页面中的链接,然后又回到我的应用程序。任何帮助将不胜感激。