Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (18 sloc) 0.541 kb
require 'rest'
require 'uber_config'
require 'base64'
print "Enter your github username: "
username = gets.chomp
print "Enter your github password: "
password = gets.chomp
p username
p password
base_url = "https://api.github.com/"
@header_value = "Basic #{Base64.encode64([username, password].join(':')).gsub("\n", '')}"
headers = {'Authorization'=>@header_value}
@rest = Rest::Client.new
r = @rest.post("#{base_url}authorizations", headers: headers, body: {})
p r
p r.body
body = JSON.parse(r.body)
puts "Your token is #{body["token"]}"
Jump to Line
Something went wrong with that request. Please try again.