Skip to content

Instantly share code, notes, and snippets.

@pbruna
Created October 8, 2015 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbruna/8a3bd49c3682e1c737b6 to your computer and use it in GitHub Desktop.
Save pbruna/8a3bd49c3682e1c737b6 to your computer and use it in GitHub Desktop.
oauth_zimbra_example.rb
pbruna@pbrunamac ~ $ pry
[1] pry(main)>
[1] pry(main)> require 'oauth' => true
[2] pry(main)> @consumer=OAuth::Consumer.new( "esta_es_la_key","este_es_el_secret", { site: 'https://mail.zboxtest.com', request_token_path: '/service/extension/sampleoauth/req_token', authorize_path: '/service/extension/sampleoauth/authorization', access_token_path: '/service/extension/sampleoauth/access_token'})
=> #<OAuth::Consumer:0x007fc592b1e5e0
@key="esta_es_la_key",
@options=
{:signature_method=>"HMAC-SHA1",
:request_token_path=>"/service/extension/sampleoauth/req_token",
:authorize_path=>"/service/extension/sampleoauth/authorization",
:access_token_path=>"/service/extension/sampleoauth/access_token",
:proxy=>nil,
:scheme=>:header,
:http_method=>:post,
:oauth_version=>"1.0",
:site=>"https://mail.zboxtest.com"},
@secret="este_es_el_secret">
[3] pry(main)> @consumer.get_request_token => #<OAuth::RequestToken:0x007fc591b7d848
@consumer=
#<OAuth::Consumer:0x007fc592b1e5e0
@http=#<Net::HTTP mail.zboxtest.com:443 open=false>,
@http_method=:post,
@key="esta_es_la_key",
@options=
{:signature_method=>"HMAC-SHA1",
:request_token_path=>"/service/extension/sampleoauth/req_token",
:authorize_path=>"/service/extension/sampleoauth/authorization",
:access_token_path=>"/service/extension/sampleoauth/access_token",
:proxy=>nil,
:scheme=>:header,
:http_method=>:post,
:oauth_version=>"1.0",
:site=>"https://mail.zboxtest.com"},
@secret="este_es_el_secret">,
@params=
{:oauth_token=>"925023db26de5b7e8f5e85b44accbf77",
"oauth_token"=>"925023db26de5b7e8f5e85b44accbf77",
:oauth_token_secret=>"29b53e3496a062018b25ace1e0a9259c",
"oauth_token_secret"=>"29b53e3496a062018b25ace1e0a9259c",
:oauth_callback_confirmed=>"true",
"oauth_callback_confirmed"=>"true"},
@secret="29b53e3496a062018b25ace1e0a9259c",
@token="925023db26de5b7e8f5e85b44accbf77">
[4] pry(main)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment