I am trying to create QuickBlox session from Rest API using Ruby on Rails. My current implementation:
def qb_signin_params
timestamp = Time.now.in_time_zone('UTC').to_i
nonce = rand.to_s[2..6]
signature_string = "application_id=#{QuickBlox_Application_Id}&auth_key=#{QUICKBLOX_Authorization_KEY}&nonce=#{nonce}×tamp=#{timestamp}"
digest = OpenSSL::Digest.new('sha1')
signature = OpenSSL::HMAC.hexdigest(digest, signature_string, QUICKBLOX_Authorization_SECRET)
params = Hash.new
params['application_id'] = QuickBlox_Application_Id
params['auth_key'] = QUICKBLOX_Authorization_KEY
params['timestamp'] = timestamp
params['nonce'] = nonce
params['signature'] = signature
params
end
Returns following error:
unexpected token at '<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error>Unexpected signature</error>
</errors>
I have searched through several places, but could never find the correct Signature generation for Ruby. Please help.