#!/usr/bin/perl

###########################################
# google-drive-init
# Mike Schilli, 2014 (m@perlmeister.com)
###########################################
use strict;

# abort earlier if requires deps are missing
use LWP::Protocol::https;

use OAuth::Cmdline::GoogleDrive;
use OAuth::Cmdline::Mojo;

my $oauth = OAuth::Cmdline::GoogleDrive->new(
    client_id     => q[XXXXXXXX.apps.googleusercontent.com],
    client_secret => q[YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY],
    login_uri     => "https://accounts.google.com/o/oauth2/auth",
    token_uri     => "https://accounts.google.com/o/oauth2/token",
    scope         => "https://www.googleapis.com/auth/drive",
    access_type   => "offline",
);

my $app = OAuth::Cmdline::Mojo->new(
    oauth => $oauth,
);

$app->start( 'daemon', '-l', $oauth->local_uri );