Module: Signet::OAuth1::PLAINTEXT

Defined in:
lib/signet/oauth_1/signature_methods/plaintext.rb

Class Method Summary collapse

Class Method Details

.generate_signature(_base_string, client_credential_secret, token_credential_secret) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/signet/oauth_1/signature_methods/plaintext.rb', line 6

def self.generate_signature \
    _base_string, client_credential_secret, token_credential_secret

  # Both the client secret and token secret must be escaped
  client_credential_secret =
    Signet::OAuth1.encode client_credential_secret
  token_credential_secret =
    Signet::OAuth1.encode token_credential_secret
  # The key for the signature is just the client secret and token
  # secret joined by the '&' character.  If the token secret is omitted,
  # the '&' must still be present.
  key = [client_credential_secret, token_credential_secret].join "&"
  Signet::OAuth1.encode(key).strip
end