Twitte...ppAuth(3pm)
π Twitter::API::Trait::AppAuth π
okay bestie, so this is a page from the User Contributed Perl Documentation section of the manual β it's Twitter::API::Trait::AppAuth(3pm), aka the trait that handles App-only (OAuth2) Authentication β¨
she's rocking version 1.0006, no cap π
β¨ SYNOPSIS β¨
like, here's the whole vibe, copied exactly so you can just yeet it into your editor:
use Twitter::API;
my $client = Twitter::API->new_with_traits(
traits => [ qw/ApiMethods AppAuth/ ]);
my $r = $client->oauth2_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;
periodt π
πΈ METHODS πΈ
π¦ oauth2_token
she calls the oauth2/token endpoint to get you a bearer token. and listen β the token is not stored in Twitter::API's state. like, she's not keeping it, she's just handing it to you π«Ά if you want it saved, that's on you: set the access_token attribute with the token she gave back.
want the deets? go read <https://developer.twitter.com/en/docs/basics/authentication/api-reference/token>
π¦ invalidate_token($token)
this one calls the oauth2/invalidate_token endpoint to revoke a token. bye girl π
deets over here: <https://developer.twitter.com/en/docs/basics/authentication/api-reference/invalidate_token>
π AUTHOR π
Marc Mims <marc@questright.com>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2015-2021 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.
okay that's the whole thing, you ate it, mwah ππ this lil masterpiece was served up by perl v5.32.1 on 2021-09-11, and yeah, the header up top said Twitter::API::Trait::AppAuth(3pm) twice because she's extra like that πβ go forth and authenticate, bestie π
π¦ where this page comes from
- debian bookworm: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms