Skip to content

A better way check if Octokit basic_auth was successful #1

Description

@ryanmjacobs

We need a better way of checking whether or not the login was successful. Currently, we are just making a arbitrary API request to see if it works. If it works, then we say the login was successful; otherwise, we say it failed.

I'm sure there is a better way to do this, already built into the API.

@client = Octokit::Client.new(:login => username, :password => password)

begin
  @client.authorizations
rescue Octokit::Unauthorized
  puts "error: auth failed"
  exit                                                                
end

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions