我一直在嘗試使用twitter-omniauth
gem來驗證用戶的最後日子,但沒有成功。 (與Facebook的身份驗證完美)OAuth :: Unauthorized 401 int twitter-omniauth gem
我一直得到401未經授權的錯誤。
我通過stackoverflow搜索,但沒有答案可以解決我的問題。
當我嘗試http://127.0.0.1/users/auth/twitter
時,我到達twitter登錄。我登錄後,我被重定向到http://127.0.0.1/users/auth/twitter/callback
,併發生未經授權的錯誤。
下面回調URL我已經在Twitter上
http://127.0.0.1/users/auth/twitter/callback
rake routes
輸出
new_user_session GET /users/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"}
user_session POST /users/sign_in(.:format) {:action=>"create", :controller=>"devise/sessions"}
destroy_user_session DELETE /users/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"}
user_omniauth_callback /users/auth/:action/callback(.:format) {:action=>/twitter|facebook/, :controller=>"users/omniauth_callbacks"}
user_password POST /users/password(.:format) {:action=>"create", :controller=>"devise/passwords"}
new_user_password GET /users/password/new(.:format) {:action=>"new", :controller=>"devise/passwords"}
edit_user_password GET /users/password/edit(.:format) {:action=>"edit", :controller=>"devise/passwords"}
PUT /users/password(.:format) {:action=>"update", :controller=>"devise/passwords"}
cancel_user_registration GET /users/cancel(.:format) {:action=>"cancel", :controller=>"devise/registrations"}
user_registration POST /users(.:format) {:action=>"create", :controller=>"devise/registrations"}
new_user_registration GET /users/sign_up(.:format) {:action=>"new", :controller=>"devise/registrations"}
edit_user_registration GET /users/edit(.:format) {:action=>"edit", :controller=>"devise/registrations"}
PUT /users(.:format) {:action=>"update", :controller=>"devise/registrations"}
DELETE /users(.:format) {:action=>"destroy", :controller=>"devise/registrations"}
login /login(.:format) {:action=>"login", :controller=>"home"}
root / {:controller=>"home", :action=>"index"}
如果你需要再進入的信息,我會提供。請幫我解決這個問題。
羅伯特 - 你有沒有在你的初始化程序中檢查你的應用程序ID和應用程序密碼是否正確?它們是否與Twitter顯示的本地應用程序相匹配? – TallGreenTree
另外,你可以發佈你的用戶/ omniauth_callbacks控制器的代碼嗎? – TallGreenTree
@TallGreenTree我有雙倍檢查appication id和應用程序的祕密很多次..它是相同的... – robert