Skip to content

Instantly share code, notes, and snippets.

@mackee
Created February 16, 2013 05:49
Show Gist options
  • Save mackee/4965717 to your computer and use it in GitHub Desktop.
Save mackee/4965717 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use 5.016;
use Net::GitHub;
use Config::Pit;
my $config = pit_get('github.com');
if (exists $config->{token}) {
say 'already get token';
exit;
}
$config = pit_get('github.com', require => {
username => 'your username',
password => 'your password',
});
my $github = Net::GitHub->new(
login => $config->{username},
pass => $config->{password},
);
my $oauth = $github->oauth;
my $o = $oauth->create_authorization({scopes => [qw/gist/], note => 'gistream'});
Config::Pit::set('github.com', data => { token => $o->{token} });
say 'set done';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment