0
我在寫一個rails 3應用程序,我試圖讓人們使用LinkedIn登錄或登錄。我按照教程,但我得到了一些奇怪的結果。出於某種原因,應用程序在POST/user_sessions之後調用了/ user_sessions上的GET,這會將我的憑據發送到LinkedIn。這是從軌服務器日誌:Authlogic_Oauth調用GET/user_sessions
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控制器,這樣我就不會失敗,出現錯誤:
No route matches "/user_sessions"
,但我不明白爲什麼我沒有被重定向到鏈接登錄頁面,然後回到我的應用程序。任何幫助將不勝感激。
您是否已登錄鏈接?你是否已經授權你的應用程序?如果是這樣,那就是爲什麼你在登錄屏幕上看不到鏈接 – ctcherry 2011-03-17 05:19:01
是的!你完全正確。我已經登錄到LinkedIn。我登出後,現在我看到重定向登錄LinkedIn,當它回到我的站點時,應用程序正試圖使用/ user_sessions控制器中的索引功能。謝謝! – spinlock 2011-03-17 16:20:27
生病發貼,作爲一個答案,所以我們可以關閉這個問題。 – ctcherry 2011-03-17 17:26:58