my $oauth2 = LWP::Authen::OAuth2->new( authorization_endpoint => 'https://api.login.yahoo.com/oauth2/request_auth', token_endpoint => 'https://api.login.yahoo.com/oauth2/get_token', client_id => '****', client_secret => '****', scope => 'fspt-w', redirect_uri => 'oob', ); my $url = $oauth2->authorization_url(); my $code = prompt('x', 'Paste the code obtained at the above URL here: ', '', ''); # Exchange the code for an access token: my $token = $oauth2->request_tokens(code => $code) or die; # If we get to here, it worked! Report success: print "\nToken obtained successfully!\n"; print "Here are the token contents (just FYI):\n\n"; print $token->to_string, "\n";