Skip to content

Commit

Permalink
Adds documentation for passing blocks to the middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
philnash committed Jan 9, 2015
1 parent afdde53 commit 0a533e4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/usage/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,13 @@ a Sinatra application:
Now, any POST request to /messages in your application that doesn't validate as
a Twilio request, will automatically respond with a 403 status code and your
action will not be hit.

If you use subaccounts and need to validate with different auth tokens, you can pass a block to the middleware instead of an auth token. The block will be passed the Account Sid making the call.

.. code-block:: ruby
use Rack::TwilioWebhookAuthentication, nil, /\/messages/ do |account_sid|
# lookup auth_token from account_sid
end
Ensure you pass `nil` for the auth_token when passing a block, otherwise the block will not be called.

0 comments on commit 0a533e4

Please sign in to comment.