How do I view the params that OAuth is using to build its signature?

95 Views Asked by At

I’m using Rails 4.2.7 with this gem …

gem 'oauth'

I”m using this code to verify the signature being passed from a third party ..

require 'oauth/request_proxy/action_controller_request'
…
@oauth_signature_validator = OAuth::Signature.build(request, :consumer_secret => consumer_secret)
result = @oauth_signature_validator.verify()

However validation repeatedly fails. How can I see what OAuth::Signature request params are being used to compute and compare signatures? I have verified that the consumer secret is correct and that everything is set up properly from the third party that is sending the signatures.

1

There are 1 best solutions below

0
On

You can use a tool such asbyebug, pry or pry-remote to get a console session before @oauth_signature_validator.

To do this add either:

  • gem "byebug"
  • gem "pry"
  • gem "pry-remote"

to your Gemfile then run bundle install. Then, above the line in question add:

  • byebug (for byebug)
  • binding.pry (for pry)
  • binding.remote_pry (for pry-remote)

For the first two, it will drop you into a ruby shell when it hits the line, allowing you to inspect the request object. For pry-remote it will pause your application, requiring you to (in another shell) run bundle exec pry-remote in the application directory.