Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sig value for authentication #21

Open
ljamieb2 opened this issue Aug 11, 2015 · 2 comments
Open

sig value for authentication #21

ljamieb2 opened this issue Aug 11, 2015 · 2 comments

Comments

@ljamieb2
Copy link

Lines 83-98 of the same file (https://github.com/zaidakram/expedia/blob/master/lib/expedia/http_service.rb ) is where sig is put together and since Ruby sets variables when the service is started the timestamp is static which makes the sig static which causes authentication failures after about 5 minutes of the service being started.

This is because EAN's service will only authenticate a sig value for 5 minutes based on the EAN server time. To get the EAN server time, use EAN's ping request. Always generate a new sig value for each request to ensure your requests are authenticated.

@hendricius
Copy link

Is this issue still there?

@hendricius
Copy link

Since it's a method and not a variable, how could this be an issue?

      # Creates a Signature for Expedia using MD5 Checksum Auth.
      # Shared and Api keys are required for Signature along with the current utc time.
      def signature
        if Expedia.cid && Expedia.api_key && Expedia.shared_secret
          Digest::MD5.hexdigest(Expedia.api_key + Expedia.shared_secret + Time.now.utc.to_i.to_s)
        else
          raise Expedia::AuthCredentialsError, "cid, api_key and shared_secret are required for Expedia Authentication."
        end
      end

If I test this in the console, this rotates:

[2] pry(main)> Expedia::HTTPService.signature
=> "43e1bf4aca424e16c37f971dfc6f0c80"
[3] pry(main)> Expedia::HTTPService.signature
=> "43e1bf4aca424e16c37f971dfc6f0c80"
[4] pry(main)> Expedia::HTTPService.signature
=> "fa29bdf7bb0a357dfae4bd74279f0599"
[5] pry(main)> Expedia::HTTPService.signature
=> "fa29bdf7bb0a357dfae4bd74279f0599"
[6] pry(main)> Expedia::HTTPService.signature
=> "fa29bdf7bb0a357dfae4bd74279f0599"
[7] pry(main)> Expedia::HTTPService.signature
=> "71c13ec6440a11896e87cb50e926f933"
[8] pry(main)> Expedia::HTTPService.signature
=> "71c13ec6440a11896e87cb50e926f933"
[9] pry(main)> Expedia::HTTPService.signature
=> "71c13ec6440a11896e87cb50e926f933"
[10] pry(main)> Expedia::HTTPService.signature
=> "71c13ec6440a11896e87cb50e926f933"
[11] pry(main)> Expedia::HTTPService.signature
=> "9ee5c0c3b30392b128c74c01b87214d2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants