{"action":"created","issue":{"url":"https://api.github.com/repos/intridea/omniauth/issues/616","labels_url":"https://api.github.com/repos/intridea/omniauth/issues/616/labels{/name}","comments_url":"https://api.github.com/repos/intridea/omniauth/issues/616/comments","events_url":"https://api.github.com/repos/intridea/omniauth/issues/616/events","html_url":"https://github.com/intridea/omniauth/issues/616","id":5086873,"number":616,"title":"When I click cancel when logging in with Twitter or Facebook I get an error","user":{"login":"pupeno","id":8425,"avatar_url":"https://avatars.githubusercontent.com/u/8425?v=3","gravatar_id":"","url":"https://api.github.com/users/pupeno","html_url":"https://github.com/pupeno","followers_url":"https://api.github.com/users/pupeno/followers","following_url":"https://api.github.com/users/pupeno/following{/other_user}","gists_url":"https://api.github.com/users/pupeno/gists{/gist_id}","starred_url":"https://api.github.com/users/pupeno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pupeno/subscriptions","organizations_url":"https://api.github.com/users/pupeno/orgs","repos_url":"https://api.github.com/users/pupeno/repos","events_url":"https://api.github.com/users/pupeno/events{/privacy}","received_events_url":"https://api.github.com/users/pupeno/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2012-06-15T06:17:25Z","updated_at":"2015-07-03T23:28:58Z","closed_at":null,"body":"Hello,\n\nWhen I click cancel in the Twitter or Facebook login or auth pages, I get redirected back to my app and OmniAuth throws an exception (that obviously I can't catch). The exception is: OAuth::Unauthorized (401 Unauthorized), and the stack trace is:\n\n```text\noauth (0.4.6) lib/oauth/consumer.rb:216:in `token_request'\n  oauth (0.4.6) lib/oauth/consumer.rb:136:in `get_request_token'\n  omniauth-oauth (1.0.1) lib/omniauth/strategies/oauth.rb:29:in `request_phase'\n  omniauth-twitter (0.0.11) lib/omniauth/strategies/twitter.rb:50:in `request_phase'\n  omniauth (1.1.0) lib/omniauth/strategy.rb:207:in `request_call'\n  omniauth (1.1.0) lib/omniauth/strategy.rb:174:in `call!'\n  omniauth (1.1.0) lib/omniauth/strategy.rb:157:in `call'\n  omniauth (1.1.0) lib/omniauth/strategy.rb:177:in `call!'\n  omniauth (1.1.0) lib/omniauth/strategy.rb:157:in `call'\n  omniauth (1.1.0) lib/omniauth/builder.rb:48:in `call'\n  sass (3.1.19) lib/sass/plugin/rack.rb:54:in `call'\n  warden (1.1.1) lib/warden/manager.rb:35:in `block in call'\n  warden (1.1.1) lib/warden/manager.rb:34:in `catch'\n  warden (1.1.1) lib/warden/manager.rb:34:in `call'\n  actionpack (3.2.6) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'\n  rack (1.4.1) lib/rack/etag.rb:23:in `call'\n  rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'\n  actionpack (3.2.6) lib/action_dispatch/middleware/head.rb:14:in `call'\n  actionpack (3.2.6) lib/action_dispatch/middleware/params_parser.rb:21:in `call'\n  actionpack (3.2.6) lib/action_dispatch/middleware/flash.rb:242:in `call'\n  rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'\n  rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'\n  actionpack (3.2.6) lib/action_dispatch/middleware/cookies.rb:338:in `call'\n  activerecord (3.2.6) lib/active_record/query_cache.rb:64:in `call'\n  activerecord (3.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'\n  actionpack (3.2.6) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'\n  activesupport (3.2.6) lib/active_support/callbacks.rb:405:in `_run__60653626266012267__call__4496837804684830799__callbacks'\n  activesupport (3.2.6) lib/active_support/callbacks.rb:405:in `__run_callback'\n  activesupport (3.2.6) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'\n  activesupport (3.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks'\n  actionpack (3.2.6) lib/action_dispatch/middleware/callbacks.rb:27:in `call'\n  actionpack (3.2.6) lib/action_dispatch/middleware/reloader.rb:65:in `call'\n  actionpack (3.2.6) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'\n  actionpack (3.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'\n  actionpack (3.2.6) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'\n  railties (3.2.6) lib/rails/rack/logger.rb:26:in `call_app'\n  railties (3.2.6) lib/rails/rack/logger.rb:16:in `call'\n  quiet_assets (1.0.1) lib/quiet_assets.rb:20:in `call_with_quiet_assets'\n  actionpack (3.2.6) lib/action_dispatch/middleware/request_id.rb:22:in `call'\n  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'\n  rack (1.4.1) lib/rack/runtime.rb:17:in `call'\n  activesupport (3.2.6) lib/active_support/cache/strategy/local_cache.rb:72:in `call'\n  rack (1.4.1) lib/rack/lock.rb:15:in `call'\n  actionpack (3.2.6) lib/action_dispatch/middleware/static.rb:62:in `call'\n  airbrake (3.1.1) lib/airbrake/rack.rb:30:in `call'\n  airbrake (3.1.1) lib/airbrake/user_informer.rb:12:in `call'\n  railties (3.2.6) lib/rails/engine.rb:479:in `call'\n  railties (3.2.6) lib/rails/application.rb:220:in `call'\n  rack (1.4.1) lib/rack/content_length.rb:14:in `call'\n  railties (3.2.6) lib/rails/rack/log_tailer.rb:17:in `call'\n  thin (1.3.1) lib/thin/connection.rb:80:in `block in pre_process'\n  thin (1.3.1) lib/thin/connection.rb:78:in `catch'\n  thin (1.3.1) lib/thin/connection.rb:78:in `pre_process'\n  thin (1.3.1) lib/thin/connection.rb:53:in `process'\n  thin (1.3.1) lib/thin/connection.rb:38:in `receive_data'\n  eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'\n  eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'\n  thin (1.3.1) lib/thin/backends/base.rb:61:in `start'\n  thin (1.3.1) lib/thin/server.rb:159:in `start'\n  rack (1.4.1) lib/rack/handler/thin.rb:13:in `run'\n  rack (1.4.1) lib/rack/server.rb:265:in `start'\n  railties (3.2.6) lib/rails/commands/server.rb:70:in `start'\n  railties (3.2.6) lib/rails/commands.rb:55:in `block in <top (required)>'\n  railties (3.2.6) lib/rails/commands.rb:50:in `tap'\n  railties (3.2.6) lib/rails/commands.rb:50:in `<top (required)>'\n  script/rails:6:in `require'\n  script/rails:6:in `<top (required)>'\n  -e:1:in `load'\n  -e:1:in `<main>'\n```\n\nI asked about this in StackOverflow but I think it might be a bug: http://stackoverflow.com/questions/10963286/callback-denied-with-omniauth"},"comment":{"url":"https://api.github.com/repos/intridea/omniauth/issues/comments/118437534","html_url":"https://github.com/intridea/omniauth/issues/616#issuecomment-118437534","issue_url":"https://api.github.com/repos/intridea/omniauth/issues/616","id":118437534,"user":{"login":"grosser","id":11367,"avatar_url":"https://avatars.githubusercontent.com/u/11367?v=3","gravatar_id":"","url":"https://api.github.com/users/grosser","html_url":"https://github.com/grosser","followers_url":"https://api.github.com/users/grosser/followers","following_url":"https://api.github.com/users/grosser/following{/other_user}","gists_url":"https://api.github.com/users/grosser/gists{/gist_id}","starred_url":"https://api.github.com/users/grosser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grosser/subscriptions","organizations_url":"https://api.github.com/users/grosser/orgs","repos_url":"https://api.github.com/users/grosser/repos","events_url":"https://api.github.com/users/grosser/events{/privacy}","received_events_url":"https://api.github.com/users/grosser/received_events","type":"User","site_admin":false},"created_at":"2015-07-03T23:28:58Z","updated_at":"2015-07-03T23:28:58Z","body":"Using this now to get users back to where they came from ... or root ... setting a flash would be nice but ...\r\n\r\n```Ruby\r\nOmniAuth.config.on_failure = -> (env) do\r\n  Rack::Response.new(['302 Moved'], 302, 'Location' => env['omniauth.origin'] || \"/\").finish\r\nend\r\n```"}}