Skip to content

Instantly share code, notes, and snippets.

@felippemr
Created January 16, 2014 05:01
Show Gist options
  • Save felippemr/8450039 to your computer and use it in GitHub Desktop.
Save felippemr/8450039 to your computer and use it in GitHub Desktop.
Invalid Authenticity Token
felippe$ curl -v -H 'Authorization' -d 'user="fraposo",password=teste' -X POST http://localhost:3000/api/sessions
* Adding handle: conn: 0x7f81a2803a00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f81a2803a00) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 3000 (#0)
* Trying ::1...
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 3000 (#0)
> POST /api/sessions HTTP/1.1
> User-Agent: curl/7.30.0
> Host: localhost:3000
> Accept: */*
> Content-Length: 29
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 29 out of 29 bytes
< HTTP/1.1 422 Unprocessable Entity
< Content-Type: text/plain; charset=utf-8
< X-Request-Id: 398f3f45-e2ed-496b-97f3-2393d3f9a02e
< X-Runtime: 0.072823
* Server WEBrick/1.3.1 (Ruby/2.0.0/2013-06-27) is not blacklisted
< Server: WEBrick/1.3.1 (Ruby/2.0.0/2013-06-27)
< Date: Thu, 16 Jan 2014 04:57:49 GMT
< Content-Length: 6252
< Connection: Keep-Alive
<
ActionController::InvalidAuthenticityToken at /api/sessions
===========================================================
> ActionController::InvalidAuthenticityToken
actionpack (4.0.1) lib/action_controller/metal/request_forgery_protection.rb, line 163
--------------------------------------------------------------------------------------
``` ruby
158 def initialize(controller)
159 @controller = controller
160 end
161
162 def handle_unverified_request
> 163 raise ActionController::InvalidAuthenticityToken
164 end
165 end
166 end
167
168 protected
```
App backtrace
-------------
Full backtrace
--------------
- actionpack (4.0.1) lib/action_controller/metal/request_forgery_protection.rb:163:in `handle_unverified_request'
- actionpack (4.0.1) lib/action_controller/metal/request_forgery_protection.rb:170:in `handle_unverified_request'
- devise (3.2.2) lib/devise/controllers/helpers.rb:182:in `handle_unverified_request'
- actionpack (4.0.1) lib/action_controller/metal/request_forgery_protection.rb:177:in `verify_authenticity_token'
- activesupport (4.0.1) lib/active_support/callbacks.rb:377:in `_run__4071736114548537520__process_action__callbacks'
- activesupport (4.0.1) lib/active_support/callbacks.rb:80:in `run_callbacks'
- actionpack (4.0.1) lib/abstract_controller/callbacks.rb:17:in `process_action'
- actionpack (4.0.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
- actionpack (4.0.1) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
- activesupport (4.0.1) lib/active_support/notifications.rb:159:in `block in instrument'
- activesupport (4.0.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
- activesupport (4.0.1) lib/active_support/notifications.rb:159:in `instrument'
- actionpack (4.0.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
- actionpack (4.0.1) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
- activerecord (4.0.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
- actionpack (4.0.1) lib/abstract_controller/base.rb:136:in `process'
- actionpack (4.0.1) lib/abstract_controller/rendering.rb:44:in `process'
- actionpack (4.0.1) lib/action_controller/metal.rb:195:in `dispatch'
- actionpack (4.0.1) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
- actionpack (4.0.1) lib/action_controller/metal.rb:231:in `block in action'
- actionpack (4.0.1) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
- actionpack (4.0.1) lib/action_dispatch/routing/route_set.rb:48:in `call'
- actionpack (4.0.1) lib/action_dispatch/journey/router.rb:71:in `block in call'
- actionpack (4.0.1) lib/action_dispatch/journey/router.rb:59:in `call'
- actionpack (4.0.1) lib/action_dispatch/routing/route_set.rb:680:in `call'
- request_store (1.0.5) lib/request_store/middleware.rb:9: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 `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.0.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
- actionpack (4.0.1) lib/action_dispatch/middleware/flash.rb:241: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.0.1) lib/action_dispatch/middleware/cookies.rb:486:in `call'
- activerecord (4.0.1) lib/active_record/query_cache.rb:36:in `call'
- activerecord (4.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
- activerecord (4.0.1) lib/active_record/migration.rb:369:in `call'
- actionpack (4.0.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
- activesupport (4.0.1) lib/active_support/callbacks.rb:373:in `_run__4446476552068657598__call__callbacks'
- activesupport (4.0.1) lib/active_support/callbacks.rb:80:in `run_callbacks'
- actionpack (4.0.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
- actionpack (4.0.1) lib/action_dispatch/middleware/reloader.rb:64:in `call'
- actionpack (4.0.1) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
- better_errors (1.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
- better_errors (1.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
- better_errors (1.1.0) lib/better_errors/middleware.rb:56:in `call'
- actionpack (4.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
- actionpack (4.0.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
- railties (4.0.1) lib/rails/rack/logger.rb:38:in `call_app'
- railties (4.0.1) lib/rails/rack/logger.rb:20:in `block in call'
- activesupport (4.0.1) lib/active_support/tagged_logging.rb:67:in `block in tagged'
- activesupport (4.0.1) lib/active_support/tagged_logging.rb:25:in `tagged'
- activesupport (4.0.1) lib/active_support/tagged_logging.rb:67:in `tagged'
- railties (4.0.1) lib/rails/rack/logger.rb:20:in `call'
- actionpack (4.0.1) 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.0.1) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
- rack (1.5.2) lib/rack/lock.rb:17:in `call'
- actionpack (4.0.1) lib/action_dispatch/middleware/static.rb:64:in `call'
- rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
- railties (4.0.1) lib/rails/engine.rb:511:in `call'
- railties (4.0.1) lib/rails/application.rb:97: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'
- /Users/felippe/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
- /Users/felippe/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
- /Users/felippe/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
* Connection #0 to host localhost left intact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment