Skip to content

Instantly share code, notes, and snippets.

View diogocera's full-sized avatar
📐

Diogo Cera diogocera

📐
View GitHub Profile
@diogocera
diogocera / o_auth1.rb
Last active February 28, 2023 14:58
Create OAuth1.0 authentication header string
class OAuth1
class << self
def oauth_header(uri:, method:, access_token:, access_secret:, consumer_key:, consumer_secret:)
header = {
'oauth_consumer_key' => consumer_key,
'oauth_token' => access_token,
'oauth_nonce' => generate_nonce,
'oauth_signature_method' => 'HMAC-SHA256',
'oauth_timestamp' => Time.now.to_i,
'oauth_version' => '1.0'