Method: Client#authorize

Defined in:
lib/gripst/client.rb

#authorizeObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/gripst/client.rb', line 40

def authorize
  begin
    auth_token = client.create_authorization :scopes => ['gists'], :note => 'gripst'
  rescue Octokit::OneTimePasswordRequired
    otp = get_otp
    auth_token = authorize_with_otp otp
  rescue Octokit::Unauthorized
    puts '---'
    puts '---'
    puts '---'
    puts 'Username or password was incorrect'
    exit
  end

  write_auth_token auth_token
  auth_token
end