Skip to content

Basic Auth and OAuth

igrigorik edited this page Jan 31, 2011 · 1 revision

Basic Auth

To perform a Basic-Auth handshake, specify the authorization key inside of your headers. First field is the username, second is the password:

EventMachine.run do
  http = EventMachine::HttpRequest.new('http://www.website.com/').get :head => {'authorization' => ['user', 'pass']}
  http.callback { }
end

OAuth

For an example of performing an OAuth signed request, check the examples directory in the repo.