#!/usr/bin/perl

use strict ;
use warnings ;


use LWP::Authen::OAuth2;
 
my $dbh ;
my $token_string ;

# Constructor
my $oauth2 = LWP::Authen::OAuth2->new(
                 client_id => "108687549524-86sjq07f3ch8otl9fnr56mjnniltdrvn.apps.googleusercontent.com",
                 client_secret => "zAJO4PLxzeJ4yOaiJRk6f69k",
                 service_provider => "Google",
                 redirect_uri => "https://imapsync.lamiral.info/",
 
                 # Optional hook, but recommended.
                 #save_tokens => \&save_tokens,
                 #save_tokens_args => [ $dbh ],
 
                 # This is for when you have tokens from last time.
                 token_string => $token_string,
                 scope => 'https://mail.google.com/',
                 login_hint => 'gilles.lamiral@gmail.com',
             );
 
# URL for user to go to to start the process.
my $url = $oauth2->authorization_url();

print "url: $url\ntoken_string: $token_string\n" ;