jeudi 14 janvier 2021

Rack::OAuth2::Client::Error in rails 3 app after authenticating user

In my rails project, I am using the oauth2 gem for authentication. In the configuration, I have configured authentication, token, and user info URL correctly. When the user is login and redirected back to the callback URL I am getting the following error and I am not able to figure out what's wrong in the code.

Rack::OAuth2::Client::Error
Invalid authentication method for accessing this endpoint.

rack-oauth2 (1.0.8) lib/rack/oauth2/client.rb:119:in `handle_error_response'
rack-oauth2 (1.0.8) lib/rack/oauth2/client.rb:96:in `handle_response'
rack-oauth2 (1.0.8) lib/rack/oauth2/client.rb:70:in `access_token!'
omniauth-openid-connect (0.1.0) lib/omniauth/strategies/openid_connect.rb:83:in `access_token'
omniauth-openid-connect (0.1.0) lib/omniauth/strategies/openid_connect.rb:68: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'
meta_request (0.2.1) lib/meta_request/middlewares/app_request_handler.rb:11:in `call'
rack-contrib (1.2.0) lib/rack/contrib/response_headers.rb:17:in `call'
meta_request (0.2.1) lib/meta_request/middlewares/headers.rb:16:in `call'
meta_request (0.2.1) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
rack-openid (1.3.1) lib/rack/openid.rb:98:in `call'
actionpack (3.2.21) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.7) lib/rack/etag.rb:23:in `call'
rack (1.4.7) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.21) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.21) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.21) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.7) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.7) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.21) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.21) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.21) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.21) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.21) lib/active_support/callbacks.rb:405:in `_run__2379598500685443395__call__5000626384124356__callbacks'
activesupport (3.2.21) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.21) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.21) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.21) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.21) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.21) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.21) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.21) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.21) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.21) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.21) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.21) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.21) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.7) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.7) lib/rack/runtime.rb:17:in `call'
rack (1.4.7) lib/rack/lock.rb:15:in `call'
actionpack (3.2.21) lib/action_dispatch/middleware/static.rb:83:in `call'
rack-cors (0.4.0) lib/rack/cors.rb:80:in `call'
utf8-cleaner (0.2.3) lib/utf8-cleaner/middleware.rb:21:in `call'
railties (3.2.21) lib/rails/engine.rb:484:in `call'
railties (3.2.21) lib/rails/application.rb:231:in `call'
railties (3.2.21) lib/rails/railtie/configurable.rb:30:in `method_missing'
utf8-cleaner (0.2.3) lib/utf8-cleaner/middleware.rb:21:in `call'
passenger (4.0.29) lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
passenger (4.0.29) lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
passenger (4.0.29) lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
passenger (4.0.29) lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'
Request
Parameters:

{"code"=>"ND_VQvqLqGVCPXBxxvYf6gP43kg",
 "iss"=>"https://dev-sso.sungardas.com/am/oauth2/realms/root/realms/SungardAS",
 "client_id"=>"viewpoint"}

Aucun commentaire:

Enregistrer un commentaire