OAuth:...hHeader(3pm)
π NAME π
OAuth::Lite2::ParamMethod::AuthHeader β bestie, this is the builder/parser for the OAuth 2.0 AuthHeader type of parameter. That's it, that's the whole job, and she does it gorgeously. β¨
π SYNOPSIS π
my $meth = OAuth::Lite2::ParamMethod::AuthHeader->new;
# server side
if ($meth->match( $plack_request )) {
my ($token, $params) = $meth->parse( $plack_request );
}
# client side
my $http_req = $meth->request_builder(...);
ok so real talk, the SYNOPSIS saysrequest_builderand the METHODS section below saysbuild_request, and I am not touching a single character of either one. That's the page. Periodt. π«Ά
πΈ DESCRIPTION πΈ
She is the builder/parser for the OAuth 2.0 AuthHeader type of parameter. Building requests on one side, parsing them on the other, living her little dual-threat life. π
π METHODS π
β¨ new
Constructor. That's the whole vibe. She's born. π«
π match( $plack_request )
Returns true if the Plack::Request object you handed her is matched for the type of this method.
if ( $meth->match( $plack_request ) ) {
...
}
π§ parse( $plack_request )
She parses the Plack::Request, and returns the access token and the oauth parameters. Two things back, in that order, no cap.
my ($token, $params) = $meth->parse( $plack_request );
π οΈ build_request( %params )
Builds an HTTP::Request object. Look at all those named params, she's so organized:
my $req = $meth->build_request(
url => $url,
method => $http_method,
token => $access_token,
oauth_params => $oauth_params,
params => $params,
content => $content,
headers => $headers,
);
π°οΈ is_legacy( $plack_request )
Returns true if the Plack::Request object you passed is based on draft version 10. Throwback era, respect the elders. π«‘
if ( $meth->is_legacy( $plack_request ) ) {
...
}
π basic_clientcredentials( $plack_request )
Returns a Hash reference if the Plack::Request object you passed has client credentials in the Authorization header.
my $basic_clientcredentials = $meth->basic_credentials( $plack_request );
if( defined($basic_clientcredentials) ){
my $client_id = $basic_clientcredentials->{client_id};
my $client_secret = $basic_clientcredentials->{client_secret};
}
yup, the method name isbasic_clientcredentialsand the example callsbasic_credentials. Both are exactly as written on the page, I'm just the messenger and the messenger is obsessed with accuracy. π
π SEE ALSO π
OAuth::Lite2::ParamMethodsOAuth::Lite2::ParamMethodOAuth::Lite2::ParamMethod::FormEncodedBodyOAuth::Lite2::ParamMethod::URIQueryParameter
Go read the whole friend group, they're all icons. π
π AUTHOR π
Lyo Kato, <lyo.kato@gmail.com>
π COPYRIGHT AND LICENSE π
Copyright (C) 2010 by Lyo Kato
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
and that's the whole page, bestie!! π¦ This little gem lives in the User Contributed Perl Documentation, section 3pm, and the footer said perl v5.36.0 dated 2023-07-01 β so go forth, parse those headers, and slay. πβ¨π
π¦ where this page comes from
- debian trixie: liboauth-lite2-perl 0.11-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: liboauth-lite2-perl 0.11-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liboauth-lite2-perl 0.11-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: liboauth-lite2-perl 0.11-3 Β· 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