Scroll to navigation

Net::Twitter::Role::AppAuth(3pm) User Contributed Perl Documentation Net::Twitter::Role::AppAuth(3pm)


Net::Twitter::Role::AppAuth - OAuth2 Application Only Authentication


version 4.01043


  use Net::Twitter;
  my $nt = Net::Twitter->new(
      traits          => ['API::RESTv1_1', 'AppAuth'],
      consumer_key    => "YOUR-CONSUMER-KEY",
      consumer_secret => "YOUR-CONSUMER-SECRET",
  my $tweets = $nt->user_timeline({ screen_name => 'Twitter' });


Net::Twitter::Role::OAuth is a Net::Twitter role that provides OAuth authentication instead of the default Basic Authentication.

Note that this client only works with APIs that are compatible to OAuth authentication.


True if the client has an access_token. This does not check the validity of the access token, so requests may fail if it is invalid.
Request an access token. Returns the token as well as saving it in the object.
Get or set the access token.
Invalidates and clears the access_token.

Note: There seems to be a Twitter bug preventing this from working---perhaps a documentation bug. E.g., see: <>

2022-06-16 perl v5.34.0