我一直在尝试使用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