Created
May 15, 2015 11:39
-
-
Save lawrencejones/39e0a40f89751c7aaf46 to your computer and use it in GitHub Desktop.
Create a github auth token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gem 'octokit' | |
| require 'octokit' | |
| print "Login: "; login = gets.chomp | |
| print "Password: "; password = `read -s password; echo $password`.chomp | |
| print "\nTwo factor auth: "; two_factor = gets.chomp | |
| gh = Octokit::Client.new( | |
| login: login, | |
| password: password | |
| ) | |
| auth = gh.create_authorization( | |
| scopes: [:repo, :notifications], | |
| note: "Clippy dev", | |
| headers: { "X-GitHub-OTP" => two_factor } | |
| ) | |
| puts "Generated token: \"#{auth[:token]}\"" | |
| puts JSON.pretty_generate(auth.to_h) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment