Omniauth 404 on callback
I'm trying to integrate omniauth with my app since I've had success and a pleasurable experience using it previously on a Rails 3 app.
Unfortunately, the app I'm working on is Rails 2.3.14. When I use omniauth, everything goes well until the callback returns to my app - there is no error shown in the logs, just a random 404 message shows up. My routes are as follows:
开发者_StackOverflowmap.connect '/auth/:provider', :controller => 'user_identities', :action => 'blank'
map.callback "/auth/:provider/callback", :controller => "user_identities", :action => "create"
map.failure "/auth/failure", :controller => "user_identities", :action => "fail"
The blank action in the first line is a workaround for an error that says no method get 'auth/:provider', which it never loads since it redirects to facebook through Omniauth anyway.
Here are my logs for the error
Processing UserIdentitiesController#create (for 127.0.0.1 at 2011-10-08 22:36:26) [GET] Parameters: {"code"=>"12345", "action"=>"create", "controller"=>"user_identities", "provider"=>"facebook"} Rendering /Users/hash/myapp/public/404.html (404)
Adding a debugger or a puts in the first line of create doesn't help either
Any ideas?
Thanks
I just had this problem, getting a 404 page on the /auth/twitter/callback request coming back from twitter.
The problem was I had an application error occurring in the controller. That produced a 404 (not sure why) and not a 500.
Notice that it's trying to render #create
on a GET request. Create actions can only accept POST requests. Without seeing more of your code I don't know how to fix this specific case, but that is the problem. You may just need to add :method => :post
in your form.
精彩评论