Skip to content

Instantly share code, notes, and snippets.

@murajun1978
Created October 31, 2012 15:43
Show Gist options
  • Save murajun1978/3987758 to your computer and use it in GitHub Desktop.
Save murajun1978/3987758 to your computer and use it in GitHub Desktop.
Get the token using the API of Qiita
require 'net/https'
Net::HTTP.version_1_2
http = Net::HTTP.new('www.qiita.com', 443)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
#twittername or githubname@github
url_name = UserName
#Qiita's password
passwd = Password
response = http.post( "/api/v1/auth", "url_name=#{url_name}&password=#{passwd}" )
puts response.body
@murajun1978
Copy link
Author

Using Faraday Ruby gem is better.
https://github.com/technoweenie/faraday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment