NAME
Twitter::API::Trait::AppAuth - App-only (OAuth2) Authentication
VERSION
version 0.0101
SYNOPSIS
use Twitter::API;
my $client = Twitter::API->new_with_traits(
traits => [ qw/ApiMethods AppAuth/ ]);
my $r = $client->get_bearer_token;
# return value is hash ref:
# { token_type => 'bearer', access_token => 'AA...' }
my $token = $r->{access_token};
# you can use the token explicitly with the -token argument:
my $user = $client->show_user('twitter_api', { -token => $token });
# or you can set the access_token attribute to use it implicitly
$client->access_token($token);
my $user = $client->show_user('twitterapi');
# to revoke a token
$client->invalidate_token($token);
# if you revoke the token stored in the access_token attribute, clear it:
$client->clear_access_token;
AUTHOR
Marc Mims <marc@questright.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015-2016 by Marc Mims.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.