2014-10-25 2 views
1

레일 4.1.6 및 루비 2.1.3 및 omniauth-facebook-access-token 0.1.6을 사용하고 있습니다.omniauth-facebook-access-token이 새로운 FB 사용자를 허용하지 않음

FB 사용자의 액세스 토큰으로 설정된 access_token으로/users/auth/facebook_access_token/callback에 게시 중입니다. 여기에 오류가 있습니다. 내가하지 않으면,로드 된 미들웨어가 없기 때문에

AbstractController::ActionNotFound (The action 'facebook_access_token' could not be found for Users::OmniauthCallbacksController): 
    actionpack (4.1.6) lib/abstract_controller/base.rb:131:in `process' 
    actionview (4.1.6) lib/action_view/rendering.rb:30:in `process' 
    actionpack (4.1.6) lib/action_controller/metal.rb:196:in `dispatch' 
    actionpack (4.1.6) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' 
    actionpack (4.1.6) lib/action_controller/metal.rb:232:in `block in action' 
    actionpack (4.1.6) lib/action_dispatch/routing/route_set.rb:82:in `call' 
    actionpack (4.1.6) lib/action_dispatch/routing/route_set.rb:82:in `dispatch' 
    actionpack (4.1.6) lib/action_dispatch/routing/route_set.rb:50:in `call' 
    actionpack (4.1.6) lib/action_dispatch/routing/mapper.rb:45:in `call' 
    actionpack (4.1.6) lib/action_dispatch/journey/router.rb:73:in `block in call' 
    actionpack (4.1.6) lib/action_dispatch/journey/router.rb:59:in `each' 
    actionpack (4.1.6) lib/action_dispatch/journey/router.rb:59:in `call' 
    actionpack (4.1.6) lib/action_dispatch/routing/route_set.rb:678:in `call' 
    omniauth (1.2.2) lib/omniauth/strategy.rb:404:in `call_app!' 
    omniauth-facebook-access-token (0.1.6) lib/omniauth/strategies/facebook-access-token.rb:100:in `callback_phase' 
    omniauth (1.2.2) lib/omniauth/strategy.rb:227:in `callback_call' 
    omniauth (1.2.2) lib/omniauth/strategy.rb:184:in `call!' 
    omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call' 
    omniauth (1.2.2) lib/omniauth/strategy.rb:404:in `call_app!' 
    omniauth-facebook-access-token (0.1.6) lib/omniauth/strategies/facebook-access-token.rb:100:in `callback_phase' 
    omniauth (1.2.2) lib/omniauth/strategy.rb:227:in `callback_call' 
    omniauth (1.2.2) lib/omniauth/strategy.rb:184:in `call!' 
    omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call' 
    omniauth (1.2.2) lib/omniauth/builder.rb:59:in `call' 
    warden (1.2.3) lib/warden/manager.rb:35:in `block in call' 
    warden (1.2.3) lib/warden/manager.rb:34:in `catch' 
    warden (1.2.3) lib/warden/manager.rb:34:in `call' 
    rack (1.5.2) lib/rack/etag.rb:23:in `call' 
    rack (1.5.2) lib/rack/conditionalget.rb:35:in `call' 
    rack (1.5.2) lib/rack/head.rb:11:in `call' 
    actionpack (4.1.6) lib/action_dispatch/middleware/params_parser.rb:27:in `call' 
    actionpack (4.1.6) lib/action_dispatch/middleware/flash.rb:254:in `call' 
    rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context' 
    rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call' 
    actionpack (4.1.6) lib/action_dispatch/middleware/cookies.rb:560:in `call' 
    activerecord (4.1.6) lib/active_record/query_cache.rb:36:in `call' 
    activerecord (4.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call' 
    activerecord (4.1.6) lib/active_record/migration.rb:380:in `call' 
    actionpack (4.1.6) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' 
    activesupport (4.1.6) lib/active_support/callbacks.rb:82:in `run_callbacks' 
    actionpack (4.1.6) lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
    actionpack (4.1.6) lib/action_dispatch/middleware/reloader.rb:73:in `call' 
    actionpack (4.1.6) lib/action_dispatch/middleware/remote_ip.rb:76:in `call' 
    actionpack (4.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' 
    actionpack (4.1.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' 
    railties (4.1.6) lib/rails/rack/logger.rb:38:in `call_app' 
    railties (4.1.6) lib/rails/rack/logger.rb:20:in `block in call' 
    activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `block in tagged' 
    activesupport (4.1.6) lib/active_support/tagged_logging.rb:26:in `tagged' 
    activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `tagged' 
    railties (4.1.6) lib/rails/rack/logger.rb:20:in `call' 
    actionpack (4.1.6) lib/action_dispatch/middleware/request_id.rb:21:in `call' 
    rack (1.5.2) lib/rack/methodoverride.rb:21:in `call' 
    rack (1.5.2) lib/rack/runtime.rb:17:in `call' 
    activesupport (4.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call' 
    rack (1.5.2) lib/rack/lock.rb:17:in `call' 
    actionpack (4.1.6) lib/action_dispatch/middleware/static.rb:64:in `call' 
    rack (1.5.2) lib/rack/sendfile.rb:112:in `call' 
    railties (4.1.6) lib/rails/engine.rb:514:in `call' 
    railties (4.1.6) lib/rails/application.rb:144:in `call' 
    rack (1.5.2) lib/rack/lock.rb:17:in `call' 
    rack (1.5.2) lib/rack/content_length.rb:14:in `call' 
    rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service' 
    /home/eric/.rbenv/versions/2.1.3/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service' 
    /home/eric/.rbenv/versions/2.1.3/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run' 
    /home/eric/.rbenv/versions/2.1.3/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread' 

나는 내 설정/초기화/devise.rb에 다음을 추가 한 :

config.omniauth :facebook_access_token, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'] 

나는 내 설정에 다음을 추가 한이/문서에 따라 초기화/omniauth.rb :

    Prefix Verb  URI Pattern       Controller#Action 
     new_user_session GET  /users/sign_in(.:format)    devise/sessions#new 
      user_session POST  /users/sign_in(.:format)    devise/sessions#create 
    destroy_user_session DELETE /users/sign_out(.:format)    devise/sessions#destroy 
user_omniauth_authorize GET|POST /users/auth/:provider(.:format)  users/omniauth_callbacks#passthru {:provider=>/facebook_access_token/} 
    user_omniauth_callback GET|POST /users/auth/:action/callback(.:format) users/omniauth_callbacks#:action 
      user_password POST  /users/password(.:format)    devise/passwords#create 
     new_user_password GET  /users/password/new(.:format)   devise/passwords#new 
     edit_user_password GET  /users/password/edit(.:format)   devise/passwords#edit 
         PATCH /users/password(.:format)    devise/passwords#update 
         PUT  /users/password(.:format)    devise/passwords#update 
cancel_user_registration GET  /users/cancel(.:format)    devise/registrations#cancel 
     user_registration POST  /users(.:format)      devise/registrations#create 
    new_user_registration GET  /users/sign_up(.:format)    devise/registrations#new 
    edit_user_registration GET  /users/edit(.:format)     devise/registrations#edit 
         PATCH /users(.:format)      devise/registrations#update 
         PUT  /users(.:format)      devise/registrations#update 
         DELETE /users(.:format)      devise/registrations#destroy 
        home GET  /home(.:format)      redirect(301, /) 
        root GET /         high_voltage/pages#show {:id=>"home"} 
        page GET  /pages/*id        high_voltage/pages#show 
: 여기
Rails.application.config.middleware.use OmniAuth::Builder do 
    provider :facebook_access_token, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'] 
end 

내 경로입니다
+0

routes.rb를 게시 할 수 있습니까? – Mandeep

+0

질문이 업데이트되었습니다. Mandeep에게 감사드립니다. – Eric

+0

컨트롤러 코드도 게시 할 수 있습니까? – Mandeep

답변

1

Users::OmniauthCallbacksController#facebook을 정의했지만 Users::OmniauthCallbacksController#facebook_access_token을 정의하지 않았습니다. 이제 작동합니다!