1Net::Twitter::Role::AppUAsuetrh(C3o)ntributed Perl DocumNeentt:a:tTiwointter::Role::AppAuth(3)
2
3
4
6 Net::Twitter::Role::AppAuth - OAuth2 Application Only Authentication
7
9 version 4.01043
10
12 use Net::Twitter;
13
14 my $nt = Net::Twitter->new(
15 traits => ['API::RESTv1_1', 'AppAuth'],
16 consumer_key => "YOUR-CONSUMER-KEY",
17 consumer_secret => "YOUR-CONSUMER-SECRET",
18 );
19
20 $nt->request_token;
21
22 my $tweets = $nt->user_timeline({ screen_name => 'Twitter' });
23
25 Net::Twitter::Role::OAuth is a Net::Twitter role that provides OAuth
26 authentication instead of the default Basic Authentication.
27
28 Note that this client only works with APIs that are compatible to OAuth
29 authentication.
30
32 authorized
33 True if the client has an access_token. This does not check the
34 validity of the access token, so requests may fail if it is
35 invalid.
36
37 request_access_token
38 Request an access token. Returns the token as well as saving it in
39 the object.
40
41 access_token
42 Get or set the access token.
43
44 invalidate_token
45 Invalidates and clears the access_token.
46
47 Note: There seems to be a Twitter bug preventing this from
48 working---perhaps a documentation bug. E.g., see:
49 <https://twittercommunity.com/t/revoke-an-access-token-programmatically-always-getting-a-403-forbidden/1902>
50
51
52
53perl v5.32.1 2021-01-27 Net::Twitter::Role::AppAuth(3)